Mercurial > hg > index.cgi
changeset 19:20fa3242c6a5
Fix modifier key state detection in keyboard driver
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 08 Nov 2022 22:09:48 -0700 |
parents | 6a046bd8107f |
children | 0b3b4daa0d92 |
files | src/lwbasic.s |
diffstat | 1 files changed, 27 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lwbasic.s Tue Nov 08 21:24:55 2022 -0700 +++ b/src/lwbasic.s Tue Nov 08 22:09:48 2022 -0700 @@ -537,6 +537,25 @@ ; ; * update the state of SHIFT, CTRL, ALT ; * decode all other keys in a loop +keyb_read0a pshs b ; save flag bit + ldb a,y ; get state flag + bitb #0x40 ; did it change state? + bne keyb_read0d ; brif so + puls b,pc ; clean up and return +keyb_read0d andb #0xbf ; flag it as not changed + stb a,y + ldb a,u ; get current modifier state + eorb #0x40 ; flip the state bit + stb a,u ; save new state flags + bitb #0x40 ; Z set if not down + puls b ; get back flag bit + beq keyb_read0b ; brif key is pressed + comb ; invert bit flag + andb keyb_flags ; clear bit in flags + bra keyb_read0c ; finish up +keyb_read0b orb keyb_flags ; set the flag +keyb_read0c stb keyb_flags ; update flags + rts keyb_read leas -9,s ; make temporary buffer leay 1,s ; point to temporary state buffer clra ;* set to 0xff with C clear; start by strobing no columns for joystick @@ -555,30 +574,13 @@ stb ,y+ ; save state change information rola ; shift to next column bcs keyb_read0 ; brif we haven't done the last column - lda -1,y ; get row data for SHIFT - anda #0x40 ; did it change state? - beq keyb_read1 ; brif not - eora -1,y ; remove it from the state change records - sta -1,y - ldb #keyb_shift ; flip the shift flag - eorb keyb_flags - stb keyb_flags -keyb_read1 lda -4,y ; get row data for CTRL - anda #0x40 ; did it change state? - beq keyb_read2 ; brif not - eora -4,y ; clear from state change records - sta -4,y - ldb #keyb_ctrl ; flip the ctrl flag - eorb keyb_flags - stb keyb_flags -keyb_read2 lda -5,y ; get row data for ALT - anda #0x40 ; did it change state? - beq keyb_read3 ; brif not - eora -5,y ; clear from state change records - sta -5,y - ldb #keyb_alt ; flip the ALT flag - eorb keyb_flags - stb keyb_flags + sta PIA0.DB ; reset column strobe to none + ldd #0xff00|keyb_shift + bsr keyb_read0a + ldd #0xfc00|keyb_ctrl + bsr keyb_read0a + ldd #0xfb00|keyb_alt + bsr keyb_read0a keyb_read3 ldd #0x0701 ; initialize bit probe and counter keyb_read4 leay -1,y ; move pointers to next byte leau -1,u @@ -604,9 +606,7 @@ bne keyb_read6 ; brif not - don't need to do anything clr keyb_curscan ; clear the current repeat bra keyb_read6 -keyb_read8 clr ,s ; flag keyboard as not idle - sta keyb_curscan ; save current scan code as the repeating one - pshs d ; save current bit probe and scan code +keyb_read8 pshs d ; save current bit probe and scan code ldb #keyb_repdeli ; intialize repeat delay stb keyb_repdel bsr keyb_tobuff ; decode key to buffer