finished IRQ handler, fixed cartridge startup
This commit is contained in:
1 parent
b946675341
commit
69ea9abefd
7 files changed
+32
-9
No files matched your search
@@ -26,7 +26,6 @@ The following ROM features are currently missing:
|
|||||||
* floating point routines
|
* floating point routines
|
||||||
* tape support
|
* tape support
|
||||||
* RS-232 support
|
* RS-232 support
|
||||||
* NMI cartridge handling and BRK handling are not implemented yet
|
|
||||||
* breaking Kernal routines with RUN/STOP key
|
* breaking Kernal routines with RUN/STOP key
|
||||||
* PAL/NTSC is detected, but for now only startup banner uses the result
|
* PAL/NTSC is detected, but for now only startup banner uses the result
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
;; Cartridge ROM locations
|
||||||
|
.alias ICART_COLD_START $8000 ; $8000-$8001, cartridge cold start vector
|
||||||
|
.alias ICART_WARM_START $8002 ; $8002-$8003, cartridge warm start vector (RESTORE key)
|
||||||
|
.alias CART_SIG $8004 ; 5 bytes, signature for cartridge detection
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
cartridge_check:
|
cartridge_check:
|
||||||
ldx #$04
|
ldx #$04
|
||||||
cartridge_check_l1:
|
cartridge_check_l1:
|
||||||
lda $8002,x
|
lda CART_SIG,x
|
||||||
cmp cartridge_signature,x
|
cmp cartridge_signature,x
|
||||||
bne no_cartridge
|
bne no_cartridge
|
||||||
dex
|
dex
|
||||||
bpl cartridge_check_l1
|
bpl cartridge_check_l1
|
||||||
jmp ($8000)
|
sec
|
||||||
cartridge_signature:
|
rts
|
||||||
.byte $C3,$C2,$CD,$38,$30
|
|
||||||
no_cartridge:
|
no_cartridge:
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
cartridge_signature:
|
||||||
|
.byte $C3,$C2,$CD,$38,$30
|
||||||
@@ -13,7 +13,10 @@ default_nmi_handler:
|
|||||||
|
|
||||||
;; XXX: RS-232 support is not implemented
|
;; XXX: RS-232 support is not implemented
|
||||||
|
|
||||||
;; XXX if cartridge present, enter it through warm start vector
|
jsr cartridge_check
|
||||||
|
bcc +
|
||||||
|
jmp (ICART_WARM_START)
|
||||||
|
*
|
||||||
|
|
||||||
;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
|
;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,14 @@ irq_handler:
|
|||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
|
|
||||||
;; XXX check if caused by BRK, react accordingly
|
;; Check if caused by BRK
|
||||||
|
|
||||||
;; Call interrupt routine (only if initialised)
|
tsx
|
||||||
|
lda $0104, x ; get the pre-interrupt processor state
|
||||||
|
and #$10
|
||||||
|
bne irq_handler_brk
|
||||||
|
|
||||||
|
;; Not caused by BRK - call interrupt routine (only if initialised)
|
||||||
lda CINV
|
lda CINV
|
||||||
ora CINV+1
|
ora CINV+1
|
||||||
beq +
|
beq +
|
||||||
@@ -25,3 +30,9 @@ irq_handler:
|
|||||||
*
|
*
|
||||||
;; Vector not initialized - call default interrupt routine
|
;; Vector not initialized - call default interrupt routine
|
||||||
jmp default_irq_handler
|
jmp default_irq_handler
|
||||||
|
|
||||||
|
irq_handler_brk:
|
||||||
|
|
||||||
|
;; Interrupt caused by BRK
|
||||||
|
jmp (CBINV)
|
||||||
|
|
||||||
@@ -13,7 +13,9 @@ reset_entry:
|
|||||||
|
|
||||||
; C64 PRG p269
|
; C64 PRG p269
|
||||||
jsr cartridge_check
|
jsr cartridge_check
|
||||||
|
bcc +
|
||||||
|
jmp (ICART_COLD_START)
|
||||||
|
*
|
||||||
; The following routine is based on reading the public KERNAL jumptable routine
|
; The following routine is based on reading the public KERNAL jumptable routine
|
||||||
; list, and making unimaginative assumptions about what should be done on reset.
|
; list, and making unimaginative assumptions about what should be done on reset.
|
||||||
; Initialising IO is obviously required. also indicated by c64 prg p269.
|
; Initialising IO is obviously required. also indicated by c64 prg p269.
|
||||||
|
|||||||
Reference in new issue
Block a user