FrankenGraphics
New member
Hey Dale, did you figure this stuff out?
I just tried it today and got it working (thanks for the tutorial and examples, kasumi!). Both scores are now persistent outside mainGame (only that i haven't hooked up the new/high score compare so it stores nonsensical tile references on the lower row, presently).
There's not much to managing banks in this case - If you put code in mainASM.asm after JMP MainGameLoop (but before vectors; they must always come last in the fixed bank), yo know that code will be put in your fixed bank and so you're safe.
So that is where you put flash.asm (.include Routines\Basic\Flash.asm for example) and "SaveSubroutine".
I made it a little bit simpler for myself - i commented out the verification block, and made the bank select ($8000) immediate.
I also rolled all my data-to-save in a loop since i'm really tight on space in the fixed bank at this point.
Another approach that would give you ample space to elaborate and specify what and how you want stuff saved would be to keep all the save routines in the same bank as the save file. In that case, you must make a bankswitch prior to JSR:ing SaveSubroutine, and you need to do this from a any point in the mainloop/fixed bank.
Might be other caveats with that method; haven't tried to do it since i got everything i wanted in.
I just tried it today and got it working (thanks for the tutorial and examples, kasumi!). Both scores are now persistent outside mainGame (only that i haven't hooked up the new/high score compare so it stores nonsensical tile references on the lower row, presently).
There's not much to managing banks in this case - If you put code in mainASM.asm after JMP MainGameLoop (but before vectors; they must always come last in the fixed bank), yo know that code will be put in your fixed bank and so you're safe.
So that is where you put flash.asm (.include Routines\Basic\Flash.asm for example) and "SaveSubroutine".
I made it a little bit simpler for myself - i commented out the verification block, and made the bank select ($8000) immediate.
Code:
lda #$18 ;bank $18, now save bank
sta TargetBank
lda #0
sta TargetAddress
lda #$80 ;this selects the switchable bank window. We'll erase the first 4kB:s of this bank.
sta TargetAddress_h
CallEraseSector
I also rolled all my data-to-save in a loop since i'm really tight on space in the fixed bank at this point.
Another approach that would give you ample space to elaborate and specify what and how you want stuff saved would be to keep all the save routines in the same bank as the save file. In that case, you must make a bankswitch prior to JSR:ing SaveSubroutine, and you need to do this from a any point in the mainloop/fixed bank.
Might be other caveats with that method; haven't tried to do it since i got everything i wanted in.