restored some parts of the new keyboard scanner
This commit is contained in:
1 parent
05dbeea181
commit
71f027cdfb
4 files changed
+69
-83
No files matched your search
@@ -55,8 +55,9 @@
|
||||
!addr M65_SCRCOLMAX = $594 ; maximum allowed column
|
||||
!addr M65_KB_BUCKY = $595 ; result of bucky keys scan
|
||||
!addr M65_KB_COLSCAN = $596 ; $596-$59E results of keyboard scan, columns 0-8
|
||||
!addr M65_KB_COLSUM = $59F ; sum (OR) of the M65_KB_COLSCAN
|
||||
|
||||
; $59F-$5EB -- UNUSED --
|
||||
; $560-$5EB -- UNUSED --
|
||||
!addr M65_DMAGIC_LIST = $5F1 ; $5EF-$5FF reserved for DMAgic list, 15 bytes (modulo bytes are not needed)
|
||||
!addr M65_RS232_INBUF = $600 ; $600-$6FF -- reserved for RS-232 input buffer --
|
||||
!addr M65_RS232_OUTBUF = $700 ; $700-$7FF -- reserved for RS-232 output buffer --
|
||||
|
||||
@@ -78,10 +78,15 @@ kb_matrix_bucky_shflag: ; mask to be ORed to SHFLAG to mark key status
|
||||
!byte KEY_FLAG_SHIFT
|
||||
!byte KEY_FLAG_VENDOR
|
||||
!byte KEY_FLAG_CTRL
|
||||
!ifdef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
!byte KEY_FLAG_ALT
|
||||
!byte KEY_FLAG_NO_SCRL
|
||||
!byte KEY_FLAG_CAPSL
|
||||
} else ifdef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
!byte KEY_FLAG_ALT
|
||||
!byte KEY_FLAG_NO_SCRL
|
||||
}
|
||||
|
||||
|
||||
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
@@ -61,10 +61,6 @@ scnkey_valid_offset_cont:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
|
||||
|
||||
scnkey_toggle_if_needed: ; entry for SCNKEY (TWW/CTR version)
|
||||
|
||||
; Check if we should toggle the character set
|
||||
@@ -84,8 +80,10 @@ scnkey_toggle_if_needed: ; entry for SCNKEY (TWW/CTR version)
|
||||
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
!ifndef HOTFIX_CHARPTR {
|
||||
jsr M65_MODEGET
|
||||
bcc @2
|
||||
}
|
||||
|
||||
; Toggling charsets for C64 mode
|
||||
|
||||
@@ -95,12 +93,15 @@ scnkey_toggle_if_needed: ; entry for SCNKEY (TWW/CTR version)
|
||||
@1:
|
||||
rts
|
||||
|
||||
!ifndef HOTFIX_CHARPTR {
|
||||
|
||||
; Toggling charsets for M65 mode
|
||||
@2:
|
||||
lda VIC_CHARPTR+1
|
||||
eor #%00001000
|
||||
sta VIC_CHARPTR+1
|
||||
rts
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -111,3 +112,5 @@ scnkey_toggle_if_needed: ; entry for SCNKEY (TWW/CTR version)
|
||||
rts
|
||||
|
||||
}
|
||||
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
@@ -4,107 +4,84 @@
|
||||
|
||||
m65_scnkey:
|
||||
|
||||
; First scan the whole keyboard
|
||||
;
|
||||
; Scan the whole keyboard, store results in memory
|
||||
;
|
||||
|
||||
lda KBSCN_BUCKY
|
||||
sta M65_KB_BUCKY
|
||||
lda #$00
|
||||
sta M65_KB_COLSUM
|
||||
|
||||
ldx #$08
|
||||
@1:
|
||||
|
||||
lda #%01111111
|
||||
and KBSCN_BUCKY
|
||||
sta M65_KB_BUCKY
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_loop:
|
||||
|
||||
stx KBSCN_SELECT
|
||||
lda KBSCN_PEEK
|
||||
eor #$FF ; let bit 1 mean 'pressed', not the otherwise
|
||||
sta M65_KB_COLSCAN, x
|
||||
ora M65_KB_COLSUM
|
||||
sta M65_KB_COLSUM
|
||||
dex
|
||||
bpl @1
|
||||
bpl m65_scnkey_loop
|
||||
|
||||
; Update the SHFLAG
|
||||
;
|
||||
; Retrieve SHIFT / VENDOR / CTRL / ALT / NO SCROLL / CAPS LOCK status
|
||||
;
|
||||
|
||||
lda SHFLAG
|
||||
sta LSTSHF ; needed for SHIFT+VENDOR support
|
||||
|
||||
ldy #$00 ; the new SHFLAG will be constructed in .Y
|
||||
ldx M65_KB_BUCKY
|
||||
beq m65_scnkey_SHFLAG_ready
|
||||
ldx #$00
|
||||
stx SHFLAG
|
||||
|
||||
lda M65_KB_BUCKY
|
||||
dex ; index into kb_matrix_bucky_shflag
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_SHIFT:
|
||||
m65_scnkey_shflag_loop:
|
||||
|
||||
inx
|
||||
asr
|
||||
bcc m65_scnkey_shflag_next
|
||||
|
||||
; Bucky key pressed
|
||||
|
||||
pha
|
||||
lda kb_matrix_bucky_shflag, x
|
||||
ora SHFLAG
|
||||
sta SHFLAG
|
||||
pla
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_shflag_next:
|
||||
|
||||
bne m65_scnkey_shflag_loop
|
||||
|
||||
;
|
||||
; Scan the keyboard matrix stored in memory to determine which keys were pressed
|
||||
;
|
||||
|
||||
lda M65_KB_COLSUM
|
||||
beq m65_scnkey_no_key
|
||||
|
||||
; XXX
|
||||
|
||||
txa
|
||||
and #%00000011
|
||||
beq m65_scnkey_detect_VENDOR
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_SHIFT
|
||||
tay
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_VENDOR:
|
||||
|
||||
txa
|
||||
and #%00001000
|
||||
beq m65_scnkey_detect_CTRL
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_VENDOR
|
||||
tay
|
||||
m65_scnkey_no_key:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_CTRL:
|
||||
|
||||
txa
|
||||
and #%00000100
|
||||
beq m65_scnkey_detect_ALT
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_CTRL
|
||||
tay
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_ALT:
|
||||
|
||||
txa
|
||||
and #%00010000
|
||||
beq m65_scnkey_detect_CAPS_LOCK
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_ALT
|
||||
tay
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_CAPS_LOCK:
|
||||
|
||||
txa
|
||||
and #%01000000
|
||||
beq m65_scnkey_detect_NO_SCRL
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_NO_SCRL
|
||||
tay
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_detect_NO_SCRL:
|
||||
|
||||
txa
|
||||
and #%00100000
|
||||
beq m65_scnkey_SHFLAG_ready
|
||||
|
||||
tya
|
||||
ora #KEY_FLAG_CAPSL
|
||||
tay
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_scnkey_SHFLAG_ready:
|
||||
|
||||
sty SHFLAG
|
||||
|
||||
|
||||
; XXX
|
||||
|
||||
|
||||
Reference in new issue
Block a user