most C128 keys work now

This commit is contained in:
FeralChild64 committed 2019-10-16 17:47:26 +02:00
1 parent 703e499494
commit 5dedf1314e
3 files changed
+42 -16

No files matched your search

+5 -5
View File
@@ -12,10 +12,10 @@
kb_matrix_128:
// XXX fill-in the matrix properly!!!
.byte $41,$42,$43,$44,$45,$46,$47,$48
.byte $51,$52,$53,$54,$55,$56,$57,$58
.byte $61,$62,$63,$64,$65,$66,$67,$68
.byte KEY_HELP,$38,$38,KEY_TAB_FW,$32,$34,$37,$31
.byte KEY_ESC,$2B,$2D,$8D,$0D,$36,$39,$33
.byte $00,$30,$2E,$91,$11,$9D,$1D,$00
kb_matrix_128_bucky_filter:
@@ -23,7 +23,7 @@ kb_matrix_128_bucky_filter:
.byte %00000000
.byte %00000000
.byte %00000000 // XXX ALT, NO_SCRL - probably here
.byte %10000001 // XXX ALT, NO_SCRL - probably here
+30 -4
View File
@@ -260,13 +260,39 @@ scnkey_output_key:
lda #$03
sta KOUNT
// Output PETSCII code to the keyboard buffer
// Retrieve the PETSCII code
#if CONFIG_KEYBOARD_C128
// XXX implement C128 key matrix support here
cpy #$40
bcs !+
lda (KEYTAB), y // retrieve key code from standard matrix
jmp scnkey_got_petscii
!:
lda kb_matrix_128 - $40, y // retrieve key code from C128 extended matrix
cmp KEY_TAB_FW // special handling for SHIFT+TAB
bne scnkey_got_petscii
lda SHFLAG // special handling for SHIFT+TAB
and #KEY_FLAG_SHIFT
bne !+
lda KEY_TAB_FW
bne scnkey_got_petscii // branch alWAYS
!:
lda KEY_TAB_BW
#else
lda (KEYTAB), y
#endif
lda (KEYTAB), y
// Output PETSCII code to the keyboard buffer
scnkey_got_petscii:
beq scnkey_no_keys // branch if we have no PETSCII code for this key
ldy NDX
sta KEYD, y
+7 -7
View File
@@ -17,7 +17,7 @@
scnkey_128:
sty CIA1_PRA // disconnect all the classic keys first
sty CIA1_PRA // disconnect all the classic keys first
ldx #$02
scnkey_matrix_128_loop:
@@ -31,18 +31,18 @@ scnkey_matrix_128_loop:
bne scnkey_128_no_keys // clash, more than one key pressed
// We have at least one key pressed in this row, we need to find which one exactly
ldy #$07
scnkey_matrix_128_loop_inner: // XXX try to deduplicate this with regular SCNKEY
scnkey_matrix_128_loop_inner:
cmp kb_matrix_row_keys, y
bne !+ // not this particular key
tya // now .A contains key offset within a row
bne !+ // not this particular key
tya // now .A contains key offset within a row
clc
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
tay
jmp scnkey_matrix_128_loop_next
!:
dey
bpl scnkey_matrix_128_loop_inner
bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed
bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed
scnkey_matrix_128_loop_next:
dex
bpl scnkey_matrix_128_loop
@@ -53,7 +53,7 @@ scnkey_matrix_128_loop_next:
beq scnkey_128_done
// Shift the matrix code
.break
clc
tya
adc #$40