some work on CAPS LOCK support

This commit is contained in:
FeralChild64 committed 2020-12-01 21:31:30 +01:00
1 parent 21bc00138a
commit ddc9f10f32
7 files changed
+98 -12

No files matched your search

+13 -3
View File
@@ -132,16 +132,21 @@ m65_scnkey_next_1:
;
; XXX add proper implementation
ldx M65_KB_PRESSED+0
ldy M65_KB_PRESSED+0
; FALLTROUGH
m65_scnkey_got_key: ; .Y should now contain the key offset in matrix pointed by KEYTAB
;
; Convert the key coordinates to key code
;
; XXX add proper implementation
ldy __kb_matrix_normal, x
ldy __kb_matrix_normal, x ; XXX select matrix
beq m65_scnkey_no_key
; FALLTROUGH
m65_scnkey_output_key:
;
@@ -154,6 +159,11 @@ m65_scnkey_output_key:
cmp XMAX
+bcs scnkey_buffer_full
; Reinitialize secondary counter
lda #$03
sta KOUNT
; Put the key into the keyboard buffer
tya
@@ -0,0 +1,35 @@
;; #LAYOUT# M65 KERNAL_C #TAKE
;; #LAYOUT# * * #IGNORE
;
; MEGA65 native mode version of a well-known Kernal routine, described in:
;
; - [CM64] Computes Mapping the Commodore 64 - pages 220, 221
;
m65_scnkey_set_keytab:
; Set initial KEYTAB value
lda #<kb_matrix
sta KEYTAB+0
lda #>kb_matrix
sta KEYTAB+1
; Calculate table index
lda SHFLAG
asl ; multiply by 2 - keyboard matrix lookup table consists of words
and #$2E ; we are interested in SHIFT, VENDOR, CTRL and CAPS LOCK keys only
tax
and #$20 ; isolate CAPS LOCK bit
beq @1
txa ; we have to move the CAPS LOCK bit (only) by one position down
and #$0E
ora #$10
tax
@1:
; XXX finish the implementation
jmp scnkey_toggle_if_needed