Skip to content

Commit

Permalink
[KERNAL] add ability to bypass cartridge boot with Shift
Browse files Browse the repository at this point in the history
  • Loading branch information
mooinglemur committed Nov 9, 2024
1 parent 21b52d8 commit 87fed74
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion kernal/drivers/x16/x16.s
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
.import jsrfar
.import fetvec
.import fetch
.import softclock_timer_get
.import kbdbuf_get_modifiers
.importzp tmp2

MODIFIER_SHIFT = 1

.segment "MACHINE"

;---------------------------------------------------------------
Expand Down Expand Up @@ -157,7 +161,26 @@ boot_cartridge:
bne @no
dey
bpl @chkloop


; introduce a delay so we can reliably check for the Shift key
; which is a signal to us to skip booting the cartridge
jsr softclock_timer_get
clc
adc #60 ; 60 jiffy delay
sta tmp2
; enable interrupts for this section so that we can receive keystrokes from the SMC
cli
@delayloop:
jsr softclock_timer_get
cmp tmp2
bne @delayloop
; re-mask interrupts since we don't need them anymore for now
; the cart expects to be entered while interrupts are masked
sei
jsr kbdbuf_get_modifiers
and #MODIFIER_SHIFT
bne @no

jsr jsrfar
.word $C004
.byte 32 ; cartridge ROM
Expand Down

0 comments on commit 87fed74

Please sign in to comment.