more sane directory name, updated binaries

This commit is contained in:
FeralChild64 committed 2020-06-26 19:44:01 +02:00
1 parent d4d32095d1
commit 76aaf298b8
697 files changed
+56 -56

No files matched your search

@@ -0,0 +1,56 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
default_irq_handler:
#if CONFIG_RS232_UP9600
jsr rs232_count_channels
cpx #$00
beq !+
jsr up9600_irq
!:
#endif // CONFIG_RS232_UP9600
jsr cursor_blink
jsr JSCNKEY
jsr JUDTIM // update jiffy clock
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
// Turn tape motor on/off depending on the button state
// For CAS1 (tape motor interlock) variable description, see Mapping the C64, page 7
lda CPU_R6510
and #$10
beq !+ // branch if tape button pressed
jsr tape_motor_off
lda #$00
sta CAS1
beq default_irq_handler_end_tape // branch always
!:
lda CAS1
bne default_irq_handler_end_tape
jsr tape_motor_on
default_irq_handler_end_tape:
#endif // CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
#if CONFIG_PLATFORM_COMMODORE_64
// Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
#else
jmp return_from_interrupt
#endif
+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,17 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 * #IGNORE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// 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 CIA1_ICR
// FALL THROUGH to $EA81
@@ -0,0 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// 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 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)
return_from_interrupt:
// Restore registers and return
// Sequence according to Computes Mapping the 64 p73
ply_trash_a
plx_trash_a
pla
// FALLTROUGH
return_from_interrupt_rti:
rti
@@ -0,0 +1,41 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
default_nmi_handler:
// Implemented according to Computes Mapping the Commodore 64, page 74
// and to https://www.c64-wiki.com/wiki/Interrupt
// Save registers, sequence according to Computes Mapping the Commodore 64, page 73
pha
phx_trash_a
phy_trash_a
// XXX: RS-232 support is not implemented
// XXX confirm NMIs from CIA, or no other NMI will arrive!
#if CONFIG_PLATFORM_COMMODORE_64
jsr cartridge_check
bne !+
jmp (ICART_WARM_START)
!:
#endif
// According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request
// XXX is it right? how to check that IRQ was caused by RESTORE?
jsr JSTOP
bcs !+
jmp return_from_interrupt // no STOP pressed
!:
// STOP + RESTORE - clean the address of the BRK instruction (it is not BRK) first
lda #$00
sta CMP0+0
sta CMP0+1
jmp (CBINV)
+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,38 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
default_brk_handler:
// Implemented according to Computes Mapping the Commodore 64, pages 73-74
sei // disable IRQs, to be sure they wont interfere
#if CONFIG_PLATFORM_COMMODORE_64
ldx #$00
sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible
#endif
cld // make sure this dangerous flag is disabled
#if HAS_OPCODES_65CE02
see // disable extended stack
#endif
jsr JRESTOR
jsr JIOINIT
// 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
cli
jmp (IBASIC_WARM_START)
+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.
+2
View File
@@ -0,0 +1,2 @@
# Find a programm that requires working NMIs / RESTORE key use
+9
View File
@@ -0,0 +1,9 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// $FFFA - CPU NMI Hanlder
// Uncontrovertial as this is also a CPU requirement.
.word hw_entry_nmi
+2
View File
@@ -0,0 +1,2 @@
# No program will work without a working CPU IRQ vector
*
+10
View File
@@ -0,0 +1,10 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// $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
+52
View File
@@ -0,0 +1,52 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
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:
// $EA31 - Standard IRQ routine
// $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 Computes Mapping the Commodore 64, page 73
pha
phx_trash_a
phy_trash_a
#if CONFIG_CPU_MOS_6502 && CONFIG_BCD_SAFE_INTERRUPTS
cld // clear decimal flag to allow using it without disabling interrupts
#endif
// Check if caused by BRK
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 !+
jmp (CINV)
!:
// Vector not initialized - call default interrupt routine
jmp default_irq_handler
irq_handler_brk:
// Store BRK adddress, to be displayed
sec
lda $0105, x
sbc #$02
sta CMP0+0
lda $0106, x
sbc #$00
sta CMP0+1
// Interrupt caused by BRK
jmp (CBINV)
+23
View File
@@ -0,0 +1,23 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
hw_entry_nmi:
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
#endif
// Call interrupt routine (only if initialised)
pha
lda NMINV+1 // consider zeropage NMI address as uninitialized vector
beq !+ // this allows safer interrupt vector modifications
pla
jmp (NMINV)
!:
// Vector not initialized - call default interrupt routine
pla
jmp default_nmi_handler
+60
View File
@@ -0,0 +1,60 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Routine to lock NMI interrupts, using a trick described here:
// - https://codebase64.org/doku.php?id=base:nmi_lock
//
#if CONFIG_TAPE_HEAD_ALIGN
// XXX consider broader usage of this method to make IO safer
nmi_lock:
// We will have to change NMI vector to point empty routine,
// which will not acknowledge the interrupt - thus preventing
// the NMI to be triggered again
// Our code considers zeropage address invalid, so put
// it there as a preparation
ldx #$00
stx NMINV+1
// We can now safelly replace the vector
lda #<return_from_interrupt_rti
sta NMINV+0
lda #>return_from_interrupt_rti
sta NMINV+1
// Stop timer A
stx CIA2_CRA // $DD0E
// Set timer A to 0, after starting NMI will occur immediately
stx CIA2_TIMALO // $DD04
stx CIA2_TIMAHI // $DD05
// Set timer A as source for NMI
lda #$81
sta CIA2_ICR // $DD0D
// Start timer A to trigger the NMI
lda #$01
sta CIA2_CRA // $DD0E
// All done. Unmaskable interrupts are now masked.
rts
#endif