Omegamatrix, on Sat Apr 19, 2008 11:49 PM, said:
If I'm reading it right that is $2413 with whatever is in X.
No...$CE flipflops between a value of 0 and 1. This is loaded to the X register, and then used as a pointer for the table at $F7FE. So either the value of #$13 or #$24 is put into the accumulator, and stored to $CD. The other version of the game uses values #$00 and #$24. When the program reduces the ram location $CD (via DEC) and it counts down to zero, $CE is flipped (EOR #$01). So the values are used every -other- time.
Quote
What is the value of $CD used for then?
The "dirty" way of discovering what a ram location controls is to ignore it. Try altering the DEC/BEQ combo to be 4 NOP's (so that there is no branch) and run it, then alter the DEC/BEQ to be a BNE/BEQ (so that a branch
always happens).
What you will find is that the background "thump" sound effect is constant with the latter. When using 4 NOP's, there is no sound effect at all. Because a DEC (decrease ram by 1) would only happen once per frame, the differing values would give you 2 delays for the sound effect (thump-thummmp, thump-thummmp). I guess the programmer noticed that loading a value of zero could possibly cause the DEC to wraparound (or it was a dropped byte when the rom was dumped). So the 2 values are a period of silence between the thumps heard when near the enemy.
In any case, it appears that the [a] bin is the correct version (to avoid a possible rollover error). No proof, but it seems logical.
Rom locations $F7EE to $F7FB are unused...so if it's desired to add an interrupt subroutine to the program, just move the 2-byte table there.
Edited by Nukey Shay, Sun Apr 20, 2008 4:33 AM.