Mega65 keyboard support improvements

This commit is contained in:
FeralChild64 committed 2019-11-04 20:09:19 +01:00
1 parent c2375f7ce4
commit 6f39064916
2 files changed
+36 -1

No files matched your search

+8 -1
View File
@@ -70,6 +70,13 @@
.label VIC_XSCAN = $D02F // C128 only
.label VIC_CLKRATE = $D030 // C128 only
#endif
#if CONFIG_MB_MEGA_65
.label VIC_KEY = $D02F
.label VIC_XPOS = $D050
#endif
// SID registers
@@ -165,7 +172,7 @@
.const BIT_CIA2_PRA_CLK_IN = $40 // 0 - low (pulled), 1 - high (released)
.const BIT_CIA2_PRA_DAT_IN = $80 // 0 - low (pulled), 1 - high (released)
#if CONFIG_MB_MEGA_65
#if CONFIG_MB_MEGA_65
.const C65_EXTKEYS_PR = $D607
.const C65_EXTKEYS_DDR = $D608
+28
View File
@@ -30,6 +30,34 @@
SCNKEY:
#if CONFIG_KEYBOARD_C65 && CONFIG_MB_MEGA_65
// Idea by Paul Gardner-Stephen
lda VIC_XPOS // check raster X position
cmp VIC_XPOS // if it changes, we are on a MEGA65 with VIC-IV registers already visible
bne scnkey_viciv_mode
// We are on machine that is not in VIC-IV IO mode, so try enabling it (harmless on C64/C65)
// If we are on a C65 (or MEGA65 with C65 VIC-III IO mode selected), the above test would
// have failed, but we could already be in C65 IO mode. In that case, this will disable C65 IO
// mode when done. This is not ideal, but as MEGA65s start C65 mode with VIC-IV IO mode
// selected anyway, it should not be a big problem in practice.
lda #$A5
sta VIC_KEY
lda #$96
sta VIC_KEY
jsr scnkey_viciv_mode
sta VIC_KEY
rts
scnkey_viciv_mode:
#endif
// Prepare for SHFLAG update
lda SHFLAG