finished IRQ handler, fixed cartridge startup

This commit is contained in:
FeralChild64 committed 2019-08-08 18:28:20 +02:00
1 parent b946675341
commit 69ea9abefd
7 files changed
+32 -9

No files matched your search

-1
View File
@@ -26,7 +26,6 @@ The following ROM features are currently missing:
* floating point routines
* tape support
* RS-232 support
* NMI cartridge handling and BRK handling are not implemented yet
* breaking Kernal routines with RUN/STOP key
* PAL/NTSC is detected, but for now only startup banner uses the result
+5
View File
@@ -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
+4 -4
View File
@@ -3,13 +3,13 @@
cartridge_check:
ldx #$04
cartridge_check_l1:
lda $8002,x
lda CART_SIG,x
cmp cartridge_signature,x
bne no_cartridge
dex
bpl cartridge_check_l1
jmp ($8000)
cartridge_signature:
.byte $C3,$C2,$CD,$38,$30
sec
rts
no_cartridge:
clc
rts
+3
View File
@@ -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 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
+13 -2
View File
@@ -15,9 +15,14 @@ irq_handler:
tya
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
ora CINV+1
beq +
@@ -25,3 +30,9 @@ irq_handler:
*
;; Vector not initialized - call default interrupt routine
jmp default_irq_handler
irq_handler_brk:
;; Interrupt caused by BRK
jmp (CBINV)
+3 -1
View File
@@ -13,7 +13,9 @@ reset_entry:
; C64 PRG p269
jsr cartridge_check
bcc +
jmp (ICART_COLD_START)
*
; The following routine is based on reading the public KERNAL jumptable routine
; list, and making unimaginative assumptions about what should be done on reset.
; Initialising IO is obviously required. also indicated by c64 prg p269.