Code: Select all
; wait for selection
.waitkey jsr _SCNKEY ; [6] scan keyboard
lda _KEYPRESS ; [3] ZP get key scan code
cmp #$3B ; [2] keycode for '8'
beq .relblk5 ; [2/3] relocate to 8K block 5
cmp #$01 ; [2] keycode for '3'
beq .relblk0 ; [2/3] relocate to 3K block 0
cmp #$3C ; [2] keycode for '0'
bne .waitkey ; [3/2] keep scanning if not a valid key
I'm at the point where I'm studying the SCNKEY code to see if I can find a subtle speed-related bug relating to the code-table lookup; maybe the VIA strobe logic and/or the scancode lookup fails intermittently if the routine is called in a tight loop instead of just on the IRQ...? I've got interrupts disabled at this point, by the way.
This can't be right. I must be missing something obvious. Maybe it's the VICE keyboard table not playing-nice with this laptop...