new SCNKEY is useable (but is still buggy and incomplete)

This commit is contained in:
FeralChild64 committed 2019-10-13 22:50:25 +02:00
1 parent ea60cb912f
commit 183ac3ab87
6 files changed
+35 -24

No files matched your search

+6
View File
@@ -68,10 +68,16 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start?
jsr setup_vicii
// Initialise cursor blink flags (Compute's Mapping the 64 p215)
lda #$01
sta BLNCT
sta BLNSW
// Enable cursor repeat - XXX make it configurable
lda #$80
sta RPTFLG
// Set keyboard decode vector (Compute's Mapping the 64 p215)
#if CONFIG_SCNKEY_TWW_CTR
+1 -4
View File
@@ -13,10 +13,6 @@
// and converting the values
// XXX to be extra compatible (someone could change the KEYLOG), we should make sure
// we are using the same matrix format as the original ROM does
kb_matrix:
__kb_matrix_normal:
@@ -61,6 +57,7 @@ __kb_matrix_ctrl:
// XXX extended matrices for C128/C65
// kb_matrix_ext128: $D02F
+5 -5
View File
@@ -14,14 +14,14 @@ kb_matrix_bucky_filter:
// values for OR with CIA1_PRB content to filter out bucky keys
.byte %00100100 // VENDOR + CONTROL
.byte %00010000 // SHIFT (right)
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %10000000 // SHIFT (left)
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00010000 // SHIFT (right)
.byte %00100100 // VENDOR + CONTROL
#endif // no CONFIG_SCNKEY_TWW_CTR
+7 -7
View File
@@ -15,14 +15,14 @@ kb_matrix_row_keys:
// - values for CIA1_PRA to connect only the given row
// - also used to scan a single row
.byte %01111111
.byte %10111111
.byte %11011111
.byte %11101111
.byte %11110111
.byte %11111011
.byte %11111101
.byte %11111110
.byte %11111101
.byte %11111011
.byte %11110111
.byte %11101111
.byte %11011111
.byte %10111111
.byte %01111111
#endif // no CONFIG_SCNKEY_TWW_CTR
+15 -7
View File
@@ -24,7 +24,7 @@
// XXX add Commodore 128 keyboard support
// XXX add Commodore 65 keybopard support
// XXX add support for using joystick to move sursor keys
// XXX prevent joystick port 1 interference
// XXX explicitly prevent joystick port 1 interference
#if !CONFIG_SCNKEY_TWW_CTR
@@ -98,7 +98,7 @@ scnkey_matrix_loop_inner:
cmp kb_matrix_row_keys, y
bne !+ // not this particular key
tya // now .A contains key offset within a row
sec
clc
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
tay
jmp scnkey_matrix_loop_next
@@ -111,7 +111,6 @@ scnkey_matrix_loop_next:
bpl scnkey_matrix_loop
// Scanning complete
cpy #$FF
bne scnkey_got_key
@@ -134,20 +133,27 @@ scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEY
// Reset key repeat counters - see [CM64] page 58
lda #$10
// Note: according to [CM64] it should be $10 for initializing DELAY, $06 for
// initializing KOUNT for the first time and $04 for subsequent ones - but replicating
// this would make our implementation longer, probably without improving the compatibility.
//
// Besides - since I am the one who writes the code, I will make the values exactly how I like them :D
// XXX consider making it configurable, also make configurable RPTFLG
lda #$16
sta DELAY
// FALLTROUGH
scnkey_output_key:
// Reinitialize secondary couter
// Reinitialize secondary counter
lda #$06
lda #$03
sta KOUNT
// Output PETSCII code to the keyboard buffer
lda (KEYTAB), y
beq scnkey_no_keys // branch if we have no PETSCII code for this key
ldy NDX
@@ -164,6 +170,8 @@ scnkey_handle_repeat:
// Check whether we should repeat keys
// XXX some keys should be repeat always!
lda RPTFLG
bpl scnkey_done // branch if we should do no repeat
+1 -1
View File
@@ -24,7 +24,7 @@ scnkey_set_keytab:
lda kb_matrix_lookup, x
// Add offset to the vector
sec
clc
adc KEYTAB+0
sta KEYTAB+0
lda #$00