begin implementing key repeat logic
This commit is contained in:
1 parent
0add45b798
commit
106c9dfd22
3 files changed
+37
-13
No files matched your search
@@ -62,7 +62,7 @@
|
|||||||
;; 64 = no keys repeat
|
;; 64 = no keys repeat
|
||||||
.alias key_repeat_flags $028A ; p58
|
.alias key_repeat_flags $028A ; p58
|
||||||
;; https://www.c64-wiki.com/wiki/Page_2
|
;; https://www.c64-wiki.com/wiki/Page_2
|
||||||
.alias key_repeat_speed $028B
|
.alias key_repeat_counter $028B
|
||||||
.alias key_first_repeat_delay $028C
|
.alias key_first_repeat_delay $028C
|
||||||
;; bit 0 = shift, 1 = Vendor Key, 2 = Control
|
;; bit 0 = shift, 1 = Vendor Key, 2 = Control
|
||||||
.alias key_bucky_state $028D
|
.alias key_bucky_state $028D
|
||||||
|
|||||||
+3
-8
@@ -24,14 +24,9 @@ cint:
|
|||||||
|
|
||||||
;; Set key repeat delay (Compute's Mapping the 64 p215)
|
;; Set key repeat delay (Compute's Mapping the 64 p215)
|
||||||
;; Making some numbers up here: Repeat every ~1/10th sec
|
;; Making some numbers up here: Repeat every ~1/10th sec
|
||||||
;; But require key to be held for 4x that long before
|
;; But require key to be held for ~1/3sec before
|
||||||
;; repeating
|
;; repeating (Compute's Mapping the 64 p58)
|
||||||
lda #$05
|
lda #22
|
||||||
sta key_repeat_speed
|
|
||||||
|
|
||||||
;; Set key frequency counters (Compute's Mapping the 64 p215)
|
|
||||||
asl
|
|
||||||
asl
|
|
||||||
sta key_first_repeat_delay
|
sta key_first_repeat_delay
|
||||||
|
|
||||||
;; Set current colour for text (Compute's Mapping the 64 p215)
|
;; Set current colour for text (Compute's Mapping the 64 p215)
|
||||||
|
|||||||
@@ -355,12 +355,12 @@ skip0:
|
|||||||
cmp #$ff
|
cmp #$ff
|
||||||
beq Exist ;; // Handle 'null' values
|
beq Exist ;; // Handle 'null' values
|
||||||
cmp BufferOld
|
cmp BufferOld
|
||||||
beq Exist
|
beq KeyHeld
|
||||||
cmp BufferOld+1
|
cmp BufferOld+1
|
||||||
beq Exist
|
beq KeyHeld
|
||||||
cmp BufferOld+2
|
cmp BufferOld+2
|
||||||
beq Exist
|
beq KeyHeld
|
||||||
|
RecordKeypress:
|
||||||
;; // New Key Detected
|
;; // New Key Detected
|
||||||
ldy BufferQuantity
|
ldy BufferQuantity
|
||||||
cpy #MaxKeyRollover
|
cpy #MaxKeyRollover
|
||||||
@@ -385,6 +385,35 @@ skip0:
|
|||||||
stx Buffer+1
|
stx Buffer+1
|
||||||
jmp Return
|
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.
|
BufferEmpty: ;; // No new Alphanumeric keys to handle.
|
||||||
lda #$ff
|
lda #$ff
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user