Mercurial > hg > index.cgi
changeset 13:6b3609304712
Fix keyboard make/break and buffer handling
Fix several think-os and typos in keyboard handling. With this update, at
least the letter keys along with shift actually work.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 06 Nov 2022 13:46:03 -0700 |
parents | 981a5ed51a4d |
children | 2ec8c5ea5ed2 |
files | src/lwbasic.s |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lwbasic.s Sun Nov 06 12:05:33 2022 -0700 +++ b/src/lwbasic.s Sun Nov 06 13:46:03 2022 -0700 @@ -454,6 +454,11 @@ clr keyb_flags ; reset keyboard state flags clr keyb_joystate ; clear joystick button state clr keyb_curscan ; stop any keyboard repeating + ldx #0xffff ; mark all key state as "unpressed" + stx keyb_state + stx keyb_state+2 + stx keyb_state+4 + stx keyb_state+6 rts ; The PIA reading loop is specifically set up to NOT read PIA0.DB to avoid prematurely clearing the VSYNC interrupt flag ; since that could lead to missing interrupts. Reading PIA0.DA will clear the HSYNC interrupt flag but that's less of a @@ -508,28 +513,27 @@ ldb #keyb_alt ; flip the ALT flag eorb keyb_flags stb keyb_flags -keyb_read3 ldd #0x3701 ; initialize bit probe and counter +keyb_read3 ldd #0x0701 ; initialize bit probe and counter keyb_read4 leay -1,y ; move pointers to next byte leau -1,u keyb_read5 bitb ,y ; did this key change state? bne keyb_read7 ; brif so -keyb_read6 lslb ; shift bit probe - suba #8 ; adjust scan code +keyb_read6 adda #8 ; adjust scan code + lslb ; shift bit probe bpl keyb_read5 ; brif we haven't done all bits ldb ,y ; update state flags for this byte eorb ,u stb ,u ldb #1 ; reset bit probe + anda #0x07 ; reset scan code deca ; adjust for next column - adda #0x38 ; reset scan code - cmpa #0x30 ; done all bytes? - bhs keyb_read4 ; brif not - do another + bpl keyb_read4 ; brif not - do another leas 9,s ; clean up stack ldb keyb_curscan ; is key repeating? bne keyb_read9 ; brif so keyb_reada rts keyb_read7 bitb ,u ; get current state - beq keyb_read8 ; brif key pressed (make) + bne keyb_read8 ; brif key pressed (make) cmpa keyb_curscan ; is it the currently repeating key? bne keyb_read6 ; brif not - don't need to do anything clr keyb_curscan ; clear the current repeat @@ -553,7 +557,7 @@ bhi keyb_tobuff6 ; brif not ldb keyb_flags ; get shift flags bitb #keyb_ctrl|keyb_alt ; ALT or CTRL? - beq keyb_tobuff4 ; brif not + bne keyb_tobuff4 ; brif one or both ora #0x60 ; make lower case bitb #keyb_caps ; capslock enabled? beq keyb_tobuff0 ; brif not @@ -567,7 +571,7 @@ blo keyb_tobuff2 ; brif not ldx #keyb_buff ; reset pointer to start keyb_tobuff2 cmpx keyb_buffr ; did we run into the read pointer? - bne keyb_tobuff3 ; brif not - there was room + beq keyb_tobuff3 ; brif so - there wasn't room so don't save pointer stx keyb_buffw ; update the write pointer keyb_tobuff3 rts keyb_tobuff4 bitb #keyb_alt ; is ALT?