most C128 keys work now
This commit is contained in:
1 parent
703e499494
commit
5dedf1314e
3 files changed
+42
-16
No files matched your search
@@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
kb_matrix_128:
|
kb_matrix_128:
|
||||||
|
|
||||||
// XXX fill-in the matrix properly!!!
|
.byte KEY_HELP,$38,$38,KEY_TAB_FW,$32,$34,$37,$31
|
||||||
.byte $41,$42,$43,$44,$45,$46,$47,$48
|
.byte KEY_ESC,$2B,$2D,$8D,$0D,$36,$39,$33
|
||||||
.byte $51,$52,$53,$54,$55,$56,$57,$58
|
.byte $00,$30,$2E,$91,$11,$9D,$1D,$00
|
||||||
.byte $61,$62,$63,$64,$65,$66,$67,$68
|
|
||||||
|
|
||||||
kb_matrix_128_bucky_filter:
|
kb_matrix_128_bucky_filter:
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ kb_matrix_128_bucky_filter:
|
|||||||
|
|
||||||
.byte %00000000
|
.byte %00000000
|
||||||
.byte %00000000
|
.byte %00000000
|
||||||
.byte %00000000 // XXX ALT, NO_SCRL - probably here
|
.byte %10000001 // XXX ALT, NO_SCRL - probably here
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -260,13 +260,39 @@ scnkey_output_key:
|
|||||||
lda #$03
|
lda #$03
|
||||||
sta KOUNT
|
sta KOUNT
|
||||||
|
|
||||||
// Output PETSCII code to the keyboard buffer
|
// Retrieve the PETSCII code
|
||||||
|
|
||||||
#if CONFIG_KEYBOARD_C128
|
#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
|
#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
|
beq scnkey_no_keys // branch if we have no PETSCII code for this key
|
||||||
ldy NDX
|
ldy NDX
|
||||||
sta KEYD, y
|
sta KEYD, y
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
scnkey_128:
|
scnkey_128:
|
||||||
|
|
||||||
sty CIA1_PRA // disconnect all the classic keys first
|
sty CIA1_PRA // disconnect all the classic keys first
|
||||||
|
|
||||||
ldx #$02
|
ldx #$02
|
||||||
scnkey_matrix_128_loop:
|
scnkey_matrix_128_loop:
|
||||||
@@ -31,18 +31,18 @@ scnkey_matrix_128_loop:
|
|||||||
bne scnkey_128_no_keys // clash, more than one key pressed
|
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
|
// We have at least one key pressed in this row, we need to find which one exactly
|
||||||
ldy #$07
|
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
|
cmp kb_matrix_row_keys, y
|
||||||
bne !+ // not this particular key
|
bne !+ // not this particular key
|
||||||
tya // now .A contains key offset within a row
|
tya // now .A contains key offset within a row
|
||||||
clc
|
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
|
tay
|
||||||
jmp scnkey_matrix_128_loop_next
|
jmp scnkey_matrix_128_loop_next
|
||||||
!:
|
!:
|
||||||
dey
|
dey
|
||||||
bpl scnkey_matrix_128_loop_inner
|
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:
|
scnkey_matrix_128_loop_next:
|
||||||
dex
|
dex
|
||||||
bpl scnkey_matrix_128_loop
|
bpl scnkey_matrix_128_loop
|
||||||
@@ -53,7 +53,7 @@ scnkey_matrix_128_loop_next:
|
|||||||
beq scnkey_128_done
|
beq scnkey_128_done
|
||||||
|
|
||||||
// Shift the matrix code
|
// Shift the matrix code
|
||||||
.break
|
|
||||||
clc
|
clc
|
||||||
tya
|
tya
|
||||||
adc #$40
|
adc #$40
|
||||||
|
|||||||
Reference in new issue
Block a user