Closed c64skate closed 4 years ago
This is surprising. The code uses KVARS_START and KVARS_END to switch banks:
The macros are defined here:
https://github.com/commanderx16/x16-rom/blob/a1d057289d9461ecb41604d2a1957798dd9b9d5a/banks.inc
Can you give me a small test program that shows the issue?
I'm now tracing the bug and i will share a simplified code but i can give you a clue. it doesn't happen if you don't press a key (move your joystick). it switches to bank #0 as soon as you move the joystick. it might be a messed up stack issue.
Here is the test case in KickAssembler format. Please notice left border color is read from current banked memory address which is set to 1. When you press any key or move joystick, bank switches to 0.
i'm not sure if you consider this as a bug but even if isn't, it should be mentioned in documentation. in my opinion, it's a bug since you don't expect a kernal call to switch banked memory which has nothing to do with memory.
i understand now kernal uses banked memory space and i'm fine with it. but current banked memory should be preserved.
this is my workaround.
// set RAM bank to 1 lda #$01 sta $9f61 ... jsr $ff56 // joystick_get // set RAM bank to 1 > AGAIN < ldx #$01 stx $9f61 ...
this is not ideal.