implemented BRK handling routine (not yet connected to IRQ)

This commit is contained in:
FeralChild64 committed 2019-08-06 20:54:27 +02:00
1 parent 44ca73be40
commit 03bc8b8e78
17 files changed
+51 -29

No files matched your search

@@ -1,3 +1,4 @@
default_irq_handler:
jsr blink_cursor
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
@@ -0,0 +1,11 @@
;; https://csdb.dk/forums/index.php?roomid=11&topicid=5776
;; Clear the CIA1 interrupt flag, and then fall through to
;; the return from interrupt routine
clear_cia1_interrupt_flag_and_return_from_interrupt:
;; We have free choice of LDA, LDX or LDY to achieve this goal
;; in 3 bytes and minimum cycles. Thus we randomly choose LDY.
LDY $DC0D
;; FALL THROUGH to $EA81
@@ -0,0 +1,18 @@
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
;; relied upon, including:
;; $EA31 - Standard IRQ routine
;; $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
return_from_interrupt:
;; Restore registers and return
;; Sequence according to Compute's Mapping the 64 p73
pla
tay
pla
tax
pla
rti
@@ -1,7 +1,11 @@
default_nmi_handler:
;; XXX provide real implementation
;; XXX implement according to Compute's Mapping the Commodore 64, page 74
;; XXX check if the source was RESTORE key, quit if it wasn't (no RS-232 support)
;; XXX if cartridge present, enter it through warm start vector
;; XXX if stop pressed, go to default_brk_handler
inc $D020
rti
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
@@ -1,6 +1,11 @@
default_brk_handler:
;; XXX implement this!
;; Implemented according to Compute's Mapping the Commodore 64, pages 73-74
jsr JRESTOR
jsr JIOINIT
jsr CINT_BRK
jmp (IBASIC_WARM_START)
;; Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
+8
View File
@@ -0,0 +1,8 @@
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
+7 -5
View File
@@ -1,3 +1,4 @@
irq_handler:
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
@@ -7,17 +8,18 @@ irq_handler:
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
;; Save registers
;; Sequence according to Compute's Mapping the 64 p73
;; Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha
txa
pha
tya
pha
;; Call interrupt routine
;; (but only if initialised)
;; Call interrupt routine (only if initialised)
lda CINV
ora CINV+1
beq default_irq_handler
bne +
jmp (CINV)
*
;; Vector not initialized - call default interrupt routine
jmp default_irq_handler
+2
View File
@@ -1,5 +1,7 @@
nmi_handler:
;; XXX provide real implementation
jmp (NMINV)