I declare all my variables in a separate file and just include it to the source at the beginning. Makes it easier to for me to double check variables without scrolling up and down a lot. Anyway, the file contains two main SEGs, one for main ram, one for Superchip as follows:
SEG.U RAM_Variables; ORG $80 ; start of RAM RORG $80 ; snip the variable declarations SEG.U SuperChip_RAM_Variables; ORG $F000 ; Write portion RORG $F000 Write_Spirit_Realm ds 1 ; Current Realm of Spirit. (sta) ; snip rest of variables . ORG $F080; Read Portion of variables. RORG $F080 Read_Spirit_Realm ds 1 ; Current Realm of Spirit. (lda) ; snip rest of variables.
The only things snipped out are the variable declarations, otherwise the two SEGs appear exactly like that.
It's a bankswitched rom (currently 8k, but I'm expecting to need more banks before I finish.) but I compile each
rom separately then link them at the dos prompt.
One routine I have init's all the ram to 0's prior to loading defaults etc. I use Andrew's routine he gave in the
tutorials forum for the main ram+registers, and wrote this little routine for zero-ing the SuperChip's ram:
; Init the Sally Chip to all 0's as well. ldx #$7F lda #0 .InitAgain sta Write_Spirit_Realm,x dex bpl .InitAgain
Where Write_Spirit_Realm is at $F000 as per the variable declaration file.
The problem I'm getting with my code at present, as per the rom on my blog, is that if I start the rom up in an emulator, various aspects of the player gets messed up. but stays messed up consistantly if you stop and start the rom without shutting down the emulator. If you kill the emulator and start it up again, then load the rom, you get a different messed up settings - again consistantly until you kill the emulator. (I use Stella for this.) Running the rom on real hardware works a little differently in that I always get the exact same messed up config as I turn on and off the emulator. Where this is me using the krocodile cart for this, I don't know if that's playing a part for that behaviour or not.
Trying to widdle away at some of the potential causes as I continuously recede my hairline looking for the problem. So for those who are familiar with superchip programming does the code setup above look legit?














