From f104746ebc76355f49aab97f01509eb8968b6241 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 30 Jan 2020 22:37:42 +0100 Subject: [PATCH] small tape code optimization --- c64/kernal/banking/mega65_imports.s | 7 ------- c64/kernal/tape/load_tape_turbo.s | 4 ---- .../tape/tape_turbo_byte_store_mega65.s | 19 ------------------- c64/kernal/tape/tape_turbo_bytestore.s | 17 ++++++++++++++++- 4 files changed, 16 insertions(+), 31 deletions(-) delete mode 100644 c64/kernal/tape/tape_turbo_byte_store_mega65.s diff --git a/c64/kernal/banking/mega65_imports.s b/c64/kernal/banking/mega65_imports.s index 8546e2ce..d06b0bdb 100644 --- a/c64/kernal/banking/mega65_imports.s +++ b/c64/kernal/banking/mega65_imports.s @@ -55,10 +55,3 @@ .label tape_normal_byte_store = KERNAL_0.tape_normal_byte_store #endif - - -#if CONFIG_TAPE_TURBO - -.label tape_turbo_byte_store = KERNAL_0.tape_turbo_byte_store - -#endif diff --git a/c64/kernal/tape/load_tape_turbo.s b/c64/kernal/tape/load_tape_turbo.s index ab42535d..7c421e90 100644 --- a/c64/kernal/tape/load_tape_turbo.s +++ b/c64/kernal/tape/load_tape_turbo.s @@ -128,11 +128,7 @@ load_tape_turbo_payload: load_tape_turbo_loop: jsr tape_turbo_get_byte -#if ROM_LAYOUT_M65 - jsr tape_turbo_byte_store -#else jsr __tape_turbo_bytestore // like 'sta (MEMUSS),y' - but under I/O -#endif eor PRTY // handle checksum sta PRTY diff --git a/c64/kernal/tape/tape_turbo_byte_store_mega65.s b/c64/kernal/tape/tape_turbo_byte_store_mega65.s deleted file mode 100644 index bfc4b77c..00000000 --- a/c64/kernal/tape/tape_turbo_byte_store_mega65.s +++ /dev/null @@ -1,19 +0,0 @@ -// #LAYOUT# M65 KERNAL_0 #TAKE -// #LAYOUT# * * #IGNORE - -// -// Tape (turbo) helper routine - byte storage when ban changing is needed -// - - -#if CONFIG_TAPE_TURBO - - -tape_turbo_byte_store: - - jsr map_NORMAL - jsr __tape_turbo_bytestore // like 'sta (MEMUSS),y' - but under I/O - jmp map_KERNAL_1 - - -#endif diff --git a/c64/kernal/tape/tape_turbo_bytestore.s b/c64/kernal/tape/tape_turbo_bytestore.s index 25bf7a6b..03bd41f6 100644 --- a/c64/kernal/tape/tape_turbo_bytestore.s +++ b/c64/kernal/tape/tape_turbo_bytestore.s @@ -5,8 +5,10 @@ // // Tape (turbo) helper routine - storing byte uder I/O // +// Has to preserve .A and .Y +// -// This helper routine is meant to be copiet to the start of CPU stack. +// This helper routine is meant to be copied to the start of CPU stack. // Original ROM tape loading routines uses this area to store information // about bytes that did not read properly for the first time // (see Mapping the C64, page 47); this mechanism is useless for turbo tape, @@ -16,12 +18,20 @@ #if CONFIG_TAPE_TURBO +#if ROM_LAYOUT_M65 +.label __tape_turbo_bytestore_defmap = __tape_turbo_bytestore + 10 +#else .label __tape_turbo_bytestore_defmap = __tape_turbo_bytestore + 7 +#endif .label __tape_turbo_bytestore_size = __tape_turbo_bytestore_source_end - tape_turbo_bytestore_source tape_turbo_bytestore_source: +#if ROM_LAYOUT_M65 + jsr KERNAL_0.map_NORMAL +#endif + // Set all memory as RAM, tape motor ON ldx #$00 stx CPU_R6510 @@ -33,8 +43,13 @@ tape_turbo_bytestore_source: ldx #$00 // value will be determined later, offset from start: 7 bytes stx CPU_R6510 +#if ROM_LAYOUT_M65 + // Restore default map and quit + jmp KERNAL_0.map_KERNAL_1 +#else // Go back rts +#endif __tape_turbo_bytestore_source_end: