begin implementing key repeat logic

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-20 23:29:16 +09:30
1 parent 0add45b798
commit 106c9dfd22
3 files changed
+37 -13

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@
;; 64 = no keys repeat
.alias key_repeat_flags $028A ; p58
;; https://www.c64-wiki.com/wiki/Page_2
.alias key_repeat_speed $028B
.alias key_repeat_counter $028B
.alias key_first_repeat_delay $028C
;; bit 0 = shift, 1 = Vendor Key, 2 = Control
.alias key_bucky_state $028D
+3 -8
View File
@@ -24,14 +24,9 @@ cint:
;; Set key repeat delay (Compute's Mapping the 64 p215)
;; Making some numbers up here: Repeat every ~1/10th sec
;; But require key to be held for 4x that long before
;; repeating
lda #$05
sta key_repeat_speed
;; Set key frequency counters (Compute's Mapping the 64 p215)
asl
asl
;; But require key to be held for ~1/3sec before
;; repeating (Compute's Mapping the 64 p58)
lda #22
sta key_first_repeat_delay
;; Set current colour for text (Compute's Mapping the 64 p215)
+33 -4
View File
@@ -355,12 +355,12 @@ skip0:
cmp #$ff
beq Exist ;; // Handle 'null' values
cmp BufferOld
beq Exist
beq KeyHeld
cmp BufferOld+1
beq Exist
beq KeyHeld
cmp BufferOld+2
beq Exist
beq KeyHeld
RecordKeypress:
;; // New Key Detected
ldy BufferQuantity
cpy #MaxKeyRollover
@@ -385,6 +385,35 @@ skip0:
stx Buffer+1
jmp Return
KeyHeld:
;; The key in A is still held down.
;; compare with key in last_key_matrix_position
;; (Compute's Mapping the 64 p36-37)
;; if different, reset repeat count down.
cmp last_key_matrix_position
beq SameKeyHeld
;; Different key held
pha
lda key_first_repeat_delay
sta key_repeat_counter
pla
jmp Exist
SameKeyHeld:
dec key_repeat_counter
bpl +
;; Count down ended, so repeat key now
;; Reload key repeat counter
;; (Compute's Mapping the 64 p58)
pha
lda #6
sta key_repeat_counter
pla
jmp RecordKeypress
* jmp Exist
BufferEmpty: ;; // No new Alphanumeric keys to handle.
lda #$ff