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

+4
View File
@@ -0,0 +1,4 @@
Original Kernal location of the RESTOR routine.
Routine moved to original location due to game 'Duotris' calling it instead of using the Kernal jumptable.
Starting the game without this patch caused warm reset with 'BRK AT $FD15' message.
+27
View File
@@ -0,0 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmers Reference Guide - page 293 (RESTOR), 304 (VECTOR)
// - [CM64] Computes Mapping the Commodore 64 - page 237
//
// CPU registers that has to be preserved (see [RG64]): none
//
RESTOR:
clc // clear carry - for writing to system table
ldy #>vector_defaults
ldx #<vector_defaults
// FALLTHROUGH
VECTOR:
// Our implementation is longer than the original one,
// placing it here would cause a collision with VECTOR defaults
jmp vector_real
+3
View File
@@ -0,0 +1,3 @@
Address adjusted to support $FE2D - routine which is probably used by many cartridges and other software to initialize parts of the system. At least the UCart uses it - see here:
- https://www.elektroda.pl/rtvforum/topic3293027.html
+28
View File
@@ -0,0 +1,28 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmers Reference Guide - page 288
// - [CM64] Computes Mapping the Commodore 64 - page 240
//
// CPU registers that has to be preserved (see [RG64]): .A
//
MEMTOP:
bcc memtop_set
ldy MEMSIZK+1
ldx MEMSIZK+0
// FALLTROUGH
memtop_set: // for compatibility reasons this has to start at $FE2D
sty MEMSIZK+1
stx MEMSIZK+0
rts
+28
View File
@@ -0,0 +1,28 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmers Reference Guide - page 287/288
// - [CM64] Computes Mapping the Commodore 64 - page 240
//
// CPU registers that has to be preserved (see [RG64]): .A
//
MEMBOT:
bcc membot_set
ldy MEMSTR+1
ldx MEMSTR+0
// FALLTROUGH
membot_set:
sty MEMSTR+1
stx MEMSTR+0
rts
@@ -0,0 +1,85 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_MEMORY_MODEL_46K ||CONFIG_MEMORY_MODEL_50K
peek_under_roms_via_MEMUSS:
// Store current memory mapping, unmap BASIC ROM
lda CPU_R6510
pha
and #$FE
sta CPU_R6510
// Retrieve value from under ROMs
lda (MEMUSS), y
// FALLTROUGH
peek_under_roms_finalize:
// Store value in a safe place
tax
// Restore memory mapping
pla
sta CPU_R6510
// Retrieve value and quit
txa
rts
peek_under_roms_via_FNADDR:
// Store current memory mapping, unmap BASIC ROM
lda CPU_R6510
pha
and #$FE
sta CPU_R6510
// Retrieve value from under ROMs
lda (FNADDR), y
// Continue using common code
#if HAS_OPCODES_65C02
bra peek_under_roms_finalize
#else
jmp peek_under_roms_finalize
#endif
peek_under_roms_via_EAL:
// Store current memory mapping, unmap BASIC ROM
lda CPU_R6510
pha
and #$FE
sta CPU_R6510
// Retrieve value from under ROMs
lda (EAL), y
// Continue using common code
#if HAS_OPCODES_65C02
bra peek_under_roms_finalize
#else
jmp peek_under_roms_finalize
#endif
#endif
@@ -0,0 +1,74 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_MEMORY_MODEL_60K
// IMPORTANT:
// These routines lengths cannot be changed without changing
// the aliases for peek_under_roms, poke_under_roms, etc.
// Thus those addresses are expressed using formulae.
install_ram_routines:
// Copy routines into place
ldx #__ram_routines_end-__ram_routines_start-1
!:
lda __ram_routines_start,x
sta tiny_nmi_handler,x
dex
bpl !-
// Point NMI handler to tiny_nmi_handler
lda #<tiny_nmi_handler
sta $FFFE
lda #>tiny_nmi_handler
sta $FFFF
rts
__ram_routines_start:
tiny_nmi_handler_routine:
inc missed_nmi_flag
rti
peek_under_roms_routine:
php
// Offset of arg of lda ($00),y
stx peek_under_roms+pa-peek_under_roms_routine+1
jsr memmap_allram
pa: lda ($00),y
jsr memmap_normal
plp
rts
poke_under_roms_routine:
php
// Offset of arg of lda ($00),y
stx poke_under_roms+pb-poke_under_roms_routine+1
jsr memmap_allram
pb: sta ($00),y
jsr memmap_normal
plp
rts
memmap_normal_routine:
pha
lda #$37
sta $01
pla
rts
memmap_allram_routine:
sei
pha
lda #$04
sta $01
pla
rts
__ram_routines_end:
#endif
+48
View File
@@ -0,0 +1,48 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
vector_real:
// Use MEMUSS as temporary storage location - checked on real C64 that this is the
// address originally used; after calling VECTOR and checking zero page
// area afterwards, the address could be found there
// According to 'Computes Mapping the Commodore 64' page 237,
// the CBM implementation does not disable IRQs - yet, the
// 'C64 Programmers Reference Guide' does not contain such
// warning and does not mention any preparations needed.
// Initial idea was to do php, cli, ..., plp to make the routine safer,
// but it seems it might cause problem with initialization on XEMU emulator
// XXX find out, why
// Prepare the user data pointer - strange order to reduce risk
// of potential similarity to the original routine
sty MEMUSS + 1
stx MEMUSS + 0
lda #$00
sta NMINV + 1 // our routine considers this a disabled interrupt
// Select routine variant - store or restore vectors
ldy #$1F
bcc vector_restore
lda CINV, y
sta (MEMUSS), y
bcs vector_end_loop // branch always
vector_restore:
lda (MEMUSS), y
sta CINV, y
// FALLTROUGH
vector_end_loop:
dey
bpl vector_restore
rts