Skip to content

Commit 95c9e40

Browse files
committed
wait before column 1
1 parent ae72c50 commit 95c9e40

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/nmi/pollkeyboard.asm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939

4040
; Note that Family BASIC never writes to $4016 with bit 2 clear, there is no need to disable the keyboard matrix.
4141

42+
kbReadWait:
43+
ldy #$09
44+
@avoidParasiticCapacitance: ; wait approx 50 cycles after advancing rows
45+
dey
46+
bne @avoidParasiticCapacitance
47+
rts
4248

4349
pollKeyboard:
4450
ldx #$00
@@ -49,15 +55,13 @@ pollKeyboard:
4955
@rowLoop:
5056
lda #KB_COL_0
5157
sta JOY1
52-
ldy #$0A
53-
@avoidParasiticCapacitance: ; wait approx 50 cycles after advancing rows
54-
dey
55-
bne @avoidParasiticCapacitance
58+
jsr kbReadWait
5659
lda JOY2_APUFC
5760
and #KB_MASK
5861
sta generalCounter
5962
lda #KB_COL_1
6063
sta JOY1
64+
jsr kbReadWait
6165
lda JOY2_APUFC
6266
and #KB_MASK
6367
lsr

0 commit comments

Comments
 (0)