fix some more of the bugs in key repeat logic.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-24 07:40:02 +09:30
1 parent c7e265f4ac
commit 343b6f11e0
1 file changed
+16 -3
+16 -3
View File
@@ -65,6 +65,7 @@ scan_keyboard:
sta BufferQuantity sta BufferQuantity
;; Decrement key repeat timeout if non-zero ;; Decrement key repeat timeout if non-zero
inc $0423
ldx key_repeat_counter ldx key_repeat_counter
beq sk_start beq sk_start
dec key_repeat_counter dec key_repeat_counter
@@ -403,10 +404,15 @@ RecordKeypress:
bcs TooManyNewKeys bcs TooManyNewKeys
AcceptKeyEvent: AcceptKeyEvent:
sta Buffer,y sta Buffer,y
sta $0428,y
iny iny
sty BufferQuantity sty BufferQuantity
;; Set initial key repeat delay
lda key_first_repeat_delay
sta key_repeat_counter
inc $0427
ConsiderNextKey: ConsiderNextKey:
dex dex
bpl ProcessPressedKeys bpl ProcessPressedKeys
@@ -447,13 +453,17 @@ KeyHeld:
pha pha
lda key_first_repeat_delay lda key_first_repeat_delay
sta key_repeat_counter sta key_repeat_counter
inc $0426
pla pla
BuckyHeld: BuckyHeld:
jmp ConsiderNextKey jmp ConsiderNextKey
SameKeyHeld: SameKeyHeld:
dec key_repeat_counter inc $0425
bpl KeyCanRepeat pha
lda key_repeat_counter
sta $0420
bmi KeyCanRepeat
bne KeyRepeatWait bne KeyRepeatWait
;; Count down ended, so repeat key now ;; Count down ended, so repeat key now
KeyCanRepeat: KeyCanRepeat:
@@ -461,11 +471,14 @@ KeyCanRepeat:
;; (Compute's Mapping the 64 p58) ;; (Compute's Mapping the 64 p58)
pha pha
lda #6-2 ; Fudge factor to match speed lda #6-2 ; Fudge factor to match speed
inc $0424
sta key_repeat_counter sta key_repeat_counter
pla pla
pla
jmp RecordKeypress jmp RecordKeypress
KeyRepeatWait: KeyRepeatWait:
pla
jmp ConsiderNextKey jmp ConsiderNextKey