Talk:Super NES Programming/Loading SPC700 programs
From Wikibooks, the open-content textbooks collection
I may have made some mistakes when translating the IPL ROM code to an algorithm. In particular, I'm not sure that the cmp instruction on the SPC700 is doing what I think it should do. I believe that a sequence like:
cmp y,$f4
should compute (y - the contents of $f4) and set the N flag if the result is negative. This instruction sequence is used to compare the SPC's counter (in y) with the counter value sent by the SNES (in $f4) to check for the end of a block. Thus, when I send a counter value to terminate the block the SNES is sending, I expect I can send $ff, which is greater than or equal to any value the SPC counter is holding, which therefore should terminate the block, if the SPC follows the algorithm I have outlined in the tutorial. Instead, when tracing with Geiger's Snes9x debugger, I am seeing the SPC compare y (containing a low number) with address $f4, which seems to contain $ff, and it is not setting the N flag. Thus, sending $ff causes the program to lock up. But, for some reason, adding a small (< $80) value to the counter works, even though this should cause the counter to roll over in some cases, which should make the N flag unpredictable. If anyone could help clarify what is going on, I'd be grateful.
Joe Lee 14:40, 3 Jun 2005 (UTC)