count key presses from $00, not from $FF

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-24 07:21:41 +09:30
1 parent 4cd8451c6c
commit faf7547e74
1 file changed
+12 -9
+12 -9
View File
@@ -61,7 +61,7 @@
scan_keyboard: scan_keyboard:
lda #$ff lda #$00
sta BufferQuantity sta BufferQuantity
;; Decrement key repeat timeout if non-zero ;; Decrement key repeat timeout if non-zero
@@ -204,6 +204,12 @@ NoActivityDetected:
;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;; // Configure Data Direction Registers ;; // Configure Data Direction Registers
Main: Main:
;; Begin with no key events
lda #$ff
sta BufferNew+0
sta BufferNew+1
sta BufferNew+2
ldx #$ff ldx #$ff
stx $dc02 ;// Port A - Output stx $dc02 ;// Port A - Output
ldy #$00 ldy #$00
@@ -385,6 +391,7 @@ ProcessPressedKeys:
;; Check if the currently pressed key is continuing to be held down ;; Check if the currently pressed key is continuing to be held down
lda BufferNew,x lda BufferNew,x
sta $0400,x
cmp #$ff cmp #$ff
beq ConsiderNextKey beq ConsiderNextKey
cmp BufferOld cmp BufferOld
@@ -399,14 +406,13 @@ RecordKeypress:
;; // New Key Detected ;; // New Key Detected
ldy BufferQuantity ldy BufferQuantity
cpy #$ff cpy #MaxKeyRollover
beq NothingInBQ
cpy #MaxKeyRollover-1
bcs TooManyNewKeys bcs TooManyNewKeys
NothingInBQ: AcceptKeyEvent:
sta Buffer,y
sta $0428,y
iny iny
sty BufferQuantity sty BufferQuantity
sta Buffer,y
ConsiderNextKey: ConsiderNextKey:
dex dex
@@ -462,7 +468,4 @@ KeyCanRepeat:
KeyRepeatWait: KeyRepeatWait:
jmp ConsiderNextKey jmp ConsiderNextKey
BufferEmpty: ;; // No new Alphanumeric keys to handle.
lda #$ff