initial support for Mega65 extra ROM

This commit is contained in:
FeralChild64 committed 2020-01-10 22:03:10 +01:00
1 parent 7539c6b072
commit 4d56864327
333 files changed
+1747 -289

No files matched your search

@@ -1,3 +1,5 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
default_irq_handler:
@@ -42,3 +44,6 @@ default_irq_handler_end_tape:
// Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
#endif // ROM layout
@@ -1,3 +1,5 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// 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
@@ -9,3 +11,6 @@ clear_cia1_interrupt_flag_and_return_from_interrupt:
ldy CIA1_ICR
// FALL THROUGH to $EA81
#endif // ROM layout
@@ -1,8 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// 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
// $EA61 - Check keyboard, but do not 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)
@@ -10,9 +12,12 @@
return_from_interrupt:
// Restore registers and return
// Sequence according to Compute's Mapping the 64 p73
// Sequence according to Computes Mapping the 64 p73
ply_trash_a
plx_trash_a
pla
rti
#endif // ROM layout
@@ -1,10 +1,11 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
default_nmi_handler:
// Implemented according to Compute's Mapping the Commodore 64, page 74
// Implemented according to Computes Mapping the Commodore 64, page 74
// and to https://www.c64-wiki.com/wiki/Interrupt
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
// Save registers, sequence according to Computes Mapping the Commodore 64, page 73
pha
phx_trash_a
phy_trash_a
@@ -25,8 +26,11 @@ default_nmi_handler:
bcs !+
jmp return_from_interrupt // no STOP pressed
!:
// STOP + RESTORE - clean the address of the BRK instruction (it's not BRK) first
// STOP + RESTORE - clean the address of the BRK instruction (it is not BRK) first
lda #$00
sta CMP0+0
sta CMP0+1
jmp (CBINV)
#endif // ROM layout
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
default_brk_handler:
// Implemented according to Compute's Mapping the Commodore 64, pages 73-74
// Implemented according to Computes Mapping the Commodore 64, pages 73-74
sei // disable IRQs, to be sure they won't interfere
sei // disable IRQs, to be sure they wont interfere
ldx #$00
sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible
@@ -13,8 +14,8 @@ default_brk_handler:
jsr JRESTOR
jsr JIOINIT
// Original routine calls just a part of CINT - but I'm not sure which one. Most likely it
// skips the PAL/NTSC check by calling $E518. I suspect bug in the original ROM, let's
// Original routine calls just a part of CINT - but I am not sure which one. Most likely it
// skips the PAL/NTSC check by calling $E518. I suspect bug in the original ROM, lets
// call the whole CINT, just to be sure everything is initialized.
jsr CINT
@@ -22,3 +23,6 @@ default_brk_handler:
cli
jmp (IBASIC_WARM_START)
#endif // ROM layout
+5
View File
@@ -1,4 +1,9 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// $FFFA - CPU NMI Hanlder
// Uncontrovertial as this is also a CPU requirement.
.word hw_entry_nmi
#endif // ROM layout
+5
View File
@@ -1,5 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// $FFFE - CPU IRQ Vector.
// This is non-controvertial, as it is a 6502 CPU requirement, and we just have to point
// it to whatever IRQ routine we make.
.word hw_entry_irq
#endif // ROM layout
+7 -2
View File
@@ -1,3 +1,5 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
hw_entry_irq:
@@ -5,11 +7,11 @@ hw_entry_irq:
// 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
// $EA61 - Check keyboard, but do not 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)
// Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
// Save registers, sequence according to Computes Mapping the Commodore 64, page 73
pha
phx_trash_a
phy_trash_a
@@ -46,3 +48,6 @@ irq_handler_brk:
// Interrupt caused by BRK
jmp (CBINV)
#endif // ROM layout
+6 -1
View File
@@ -1,7 +1,9 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
hw_entry_nmi:
sei // don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
sei // do not allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt
#if CONFIG_CPU_MOS_6502 && CONFIG_BCD_SAFE_INTERRUPTS
cld // clear decimal flag to allow using it without disabling interrupts
@@ -18,3 +20,6 @@ hw_entry_nmi:
// Vector not initialized - call default interrupt routine
pla
jmp default_nmi_handler
#endif // ROM layout