refactor keyboard scanner somewhat, and have no variables in ROM(!)

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-20 00:59:09 +09:30
1 parent 99b06b843e
commit 67b2f3fc7d
2 files changed
+22 -13

No files matched your search

+9
View File
@@ -27,5 +27,14 @@ default_irq_handler:
jsr blink_cursor
jsr scan_keyboard
lda KeyQuantity
sta $0400
lda Buffer+0
sta $0401
lda Buffer+1
sta $0402
lda Buffer+2
sta $0403
jmp return_from_interrupt
+13 -13
View File
@@ -156,6 +156,15 @@
.alias TempZP $B6 ;// 1 byte
.alias SimultaneousKeys $F7 ;// 1 byte
;; Reuse RS232 variables, since they should not be used
;; by other things
;; These are initialised in cinit all to $FF
.alias BufferOld $293 ; 3 bytes
.alias Buffer $297 ; 4 bytes
.alias BufferQuantity $29B ; 1 byte
;// Operational Variables
.alias MaxKeyRollover 3
@@ -180,7 +189,8 @@ KeyInRow:
asl
bcs nokey0
jsr KeyFound
nokey0:
nokey0:
inx
asl
bcs nokey1
jsr KeyFound
@@ -233,11 +243,10 @@ KeyFound:
;; was: ldy KeyTable,x
pha
txa
tay
pla
ldx KeyQuantity
sty BufferNew,x
sta BufferNew,x
pla
ldx TempZP
rts
@@ -536,12 +545,3 @@ TooManyNewKeys:
sec
rts
BufferOld:
.byte $ff, $ff, $ff
Buffer:
.byte $ff, $ff, $ff, $ff
BufferQuantity:
.byte $ff