Now, I'm trying to use the new emulator v43 keyboard vector at $032E. (using KERNAL GETIN function has a delay between the first key input and the keyboard repeat, and it's noticable. You get one input, then a delay, then the constant keydown behavior. This vector was supposed to eliminate that.) I set it up exactly like my irq handler, but it runs to end of ram and crashes the system.
Code: Select all
__init_keyboard: ;replace irq handler with custom.
sei
lda KYBVec
sta default_keyboard
lda KYBVec+1
sta default_keyboard+1
lda #<custom_keyboard
sta KYBVec
lda #>custom_keyboard
sta KYBVec+1
cli
rts
custom_keyboard:
stx ZP_PTR_1
sta ZP_PTR_1+1
and #$7F
tax
lda #0
cpx ZP_PTR_1+1
adc #0
sta __Keyboard_keys,x
lda ZP_PTR_1+1
ldx ZP_PTR_1
jmp (default_keyboard)
__restore_keyboard:
sei
lda default_keyboard
sta KYBVec
lda default_keyboard+1
sta KYBVec+1
cli
rts