small startup/interrupt cleanup
This commit is contained in:
1 parent
55e2512fe2
commit
6949bd3f48
7 files changed
+8
-10
No files matched your search
@@ -1,5 +1,6 @@
|
||||
|
||||
irq_handler:
|
||||
hw_entry_irq:
|
||||
|
||||
// The IRQ is a commonly messed with thing on the C64,
|
||||
// so we need to handle entry points that are commonly
|
||||
// relied upon, including:
|
||||
@@ -52,4 +53,3 @@ irq_handler_brk:
|
||||
|
||||
// Interrupt caused by BRK
|
||||
jmp (CBINV)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
nmi_handler:
|
||||
hw_entry_nmi:
|
||||
|
||||
sei // don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
|
||||
|
||||
@@ -18,5 +18,3 @@ nmi_handler:
|
||||
// Vector not initialized - call default interrupt routine
|
||||
pla
|
||||
jmp default_nmi_handler
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Resources describing the C64 reset sequence:
|
||||
// https://www.c64-wiki.com/wiki/Reset_(Process)
|
||||
|
||||
|
||||
hw_entry_reset:
|
||||
|
||||
// The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65
|
||||
// uses the following initial reset sequence, affirmed by c64 PRG p269
|
||||
#if !HAS_BCD_SAFE_RESET
|
||||
cld // for CPUs having undefined D flag after reset
|
||||
#endif
|
||||
ldx #$FF
|
||||
txs
|
||||
sei
|
||||
|
||||
// The following routine is based on reading the public KERNAL jumptable routine
|
||||
// list, and making unimaginative assumptions about what should be done on reset.
|
||||
// Also, https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image was used
|
||||
// as it shows example startup sequence, to be followe by cartridge creators
|
||||
|
||||
// C64 PRG p269
|
||||
jsr cartridge_check
|
||||
bne !+
|
||||
jmp (ICART_COLD_START)
|
||||
!:
|
||||
// Initialising IO is obviously required. Also indicated by c64 prg p269.
|
||||
jsr JIOINIT
|
||||
|
||||
// Setting up the screen and testing ram is obviously required
|
||||
// also affirmed by p269 of c64 prg
|
||||
jsr JRAMTAS // called RANTAM on Codebase64 wiki
|
||||
|
||||
// Resetting IO vectors is obviously required, if we want interrupts to run
|
||||
// also affirmed by c64 prg p269
|
||||
jsr JRESTOR
|
||||
|
||||
// "Compute's Mapping the 64" p236
|
||||
jsr JCINT
|
||||
|
||||
// What do we do when finished? A C64 jumps into the BASIC ROM
|
||||
cli // allow interrupts to happen
|
||||
|
||||
// c64 prg p269
|
||||
jmp (IBASIC_COLD_START)
|
||||
Reference in new issue
Block a user