SPC700 help

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Re: SPC700 help

Post by wiiqwertyuiop »

ARGHRGRHRG!! I can not figure this out... As far as I can tell, I don't seem to be doing anything too different from that one, but mine won't work on bsnes... *sigh* this is the only thing stopping me from making any more progress on my homebrew... I suppose i'll post my current code again, hopefully some can tell me what I am doing wrong:

http://www.pastebay.net/1070974
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: SPC700 help

Post by Bregalad »

@Shiriu it's strange how your SPC code uses 6502-like syntax.

@wiiqwertyuiop : Maybe it would be better if you told us what goes wrong ?
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: SPC700 help

Post by Shiru »

It is optional in the Bass assembler, the best of currently available SPC700 assemblers. Actually, it is very convinient when you have previous knowledge of 6502 syntax, as the SPC700 is like a 6502 on steroids.
Jsolo
Posts: 27
Joined: Mon Jun 27, 2011 4:14 am
Location: Lurker Cave

Re: SPC700 help

Post by Jsolo »

Code: Select all

mov $f2, #$5c   ; \
mov $f3, #$ff ; |
mov $f2, #$4c   ; |
mov $f3, #$00 ; |
mov $f2, #$5c   ; |
mov $f3, #$00 ;/
You're introducing a race condition here. DSP register writes don't have an immediate effect, but are read at some specific time in a 64 cycle window.
The value of KOFF is read only ONCE during this 64 cycle window. If you do a loop like the following, there are 3 possible scenarios, depending on when the KOFF is processed by the DSP unit.

Code: Select all

loop:
<------------------- Read KOFF=$00
mov $f2, #$5c   ; \
mov $f3, #$ff ; |
mov $f2, #$4c   ; |
mov $f3, #$00 ; |
mov $f2, #$5c   ; |
mov $f3, #$00 ;/
bra loop
This does not key off any channel.

Code: Select all

loop:
mov $f2, #$5c
mov $f3, #$ff 
<------------------- Read KOFF=$FF
mov $f2, #$4c
mov $f3, #$00
mov $f2, #$5c
mov $f3, #$00
bra loop
This does key off ALL channels.

Code: Select all

loop:
mov $f2, #$5c
mov $f3, #$ff 
mov $f2, #$4c
mov $f3, #$00
mov $f2, #$5c
mov $f3, #$00
<------------------- Read KOFF=$00
bra loop
This does not key off any channels.

One solution is to write KOFF and KON only once during each main loop iteration:

Code: Select all

loop:
... (wait for next timer tick) ...

mov $f2, #$5c
mov $f3, koff_shadow
mov $f2, #$4c
mov $f3, kon_shadow

... (process channels, store key on/key off in shadow variable) ...
bra loop
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Re: SPC700 help

Post by wiiqwertyuiop »

Made some changes but still nothing in bsnes... :v

Here is my code:

http://www.pastebay.net/1071326
wiiqwertyuiop
Posts: 19
Joined: Tue Apr 17, 2012 8:30 am

Re: SPC700 help

Post by wiiqwertyuiop »

Ok, I finally, after working on it some more on my own, got it working perfectly! Thanks to those of you who helped for putting up with my stupid questions. :P
Post Reply