safer vector handling in some Kernal routines

This commit is contained in:
FeralChild64 committed 2020-07-14 23:13:17 +02:00
1 parent e349aa64f9
commit 26ce9d3b58
4 files changed
+34 -9

No files matched your search

+2 -2
View File
@@ -29,8 +29,8 @@ hw_entry_irq:
bne irq_handler_brk
// Not caused by BRK - call interrupt routine (only if initialised)
lda CINV
ora CINV+1
// Routine on zeropage = assuming not initialized
lda CINV+1
beq !+
jmp (CINV)
!:
+16 -5
View File
@@ -147,7 +147,22 @@ scnkey_bucky_loop:
// Set KEYTAB vector
jsr via_keylog // XXX for some CPUs we have indirect jsr
lda KEYLOG+1
bne !+
jsr scnkey_set_keytab // KEYLOG routine on zeropage? most likely vector not set
#if HAS_OPCODES_65C02
bra scnkey_keytab_set_done
#else
jmp scnkey_keytab_set_done
#endif
!:
#if HAS_OPCODES_65CE02
jsr_ind KEYLOG
#else
jsr scnkey_via_keylog
#endif
scnkey_keytab_set_done:
#if CONFIG_JOY2_CURSOR
@@ -483,8 +498,4 @@ scnkey_early_repeat:
rts
via_keylog:
jmp (KEYLOG)
#endif // no CONFIG_LEGACY_SCNKEY
+2 -2
View File
@@ -38,8 +38,8 @@ scnkey_set_keytab:
cmp #$FF
bne scnkey_valid_offset
// $FF means we shouldn't decode anything, mark this by setting high byte
// of KEYTAB to 0 (I don't think anyone would put keyboard decoding table
// $FF means we should not decode anything, mark this by setting high byte
// of KEYTAB to 0 (I do not think anyone would put keyboard decoding table
// at zeropage)
lda #$00
beq !+ // branch always
+14
View File
@@ -0,0 +1,14 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// Short helper jump-via-vector routine, to set the keyboard matrix
#if !HAS_OPCODES_65CE02
scnkey_via_keylog:
jmp (KEYLOG)
#endif