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