From 698a66202c29dc729a32e862309d34a3be7190e5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 19 Dec 2019 22:44:50 +0100 Subject: [PATCH] simplified some tape related code --- c64/aliases/,aliases_ram_lowmem.s | 2 +- c64/kernal/tape/load_tape_normal.s | 23 ++++++++++++----------- c64/kernal/tape/load_tape_turbo.s | 15 +++++++++------ c64/kernal/tape/tape_common.s | 6 +++--- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index babb1690..8ccfc953 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -135,7 +135,7 @@ .label SA = $B9 // current secondary address .label FA = $BA // current device number .label FNADDR = $BB // $BB-$BC current file name pointer - .label ROPRTY = $BD // tape / RS-232 temporary storage + .label ROPRTY = $BD // -- NOT IMPLEMENTED -- tape / RS-232 temporary storage .label FSBLK = $BE // -- NOT IMPLEMENTED -- .label MYCH = $BF // -- NOT IMPLEMENTED -- .label CAS1 = $C0 // tape motor interlock diff --git a/c64/kernal/tape/load_tape_normal.s b/c64/kernal/tape/load_tape_normal.s index da4f7c59..ddb6ec94 100644 --- a/c64/kernal/tape/load_tape_normal.s +++ b/c64/kernal/tape/load_tape_normal.s @@ -61,25 +61,25 @@ load_tape_normal: load_tape_normal_header: + // Read pilot and sync of the first header + jsr tape_normal_pilot ldy #$89 jsr tape_normal_sync bcs load_tape_normal_header - ldy #$10 + ldy #$00 // FALLTROUGH -load_tape_normal_header_loop: // this strange loop puts metadata after file name +load_tape_normal_header_loop: + + // Read the header jsr tape_normal_get_byte // XXX handle errors sta (TAPE1), y iny - cpy #$14 - bne !+ - ldy #$00 -!: - cpy #$10 + cpy #$15 bne load_tape_normal_header_loop // Read pilot and sync of the second header @@ -98,9 +98,11 @@ load_tape_normal_header_loop: // this strange loop puts metadata after // For now only one type of header is supported - lda TAPE1+$10 + ldy #$00 + lda (TAPE1),y + cmp #$01 - bne load_tape_normal_header // XXX also handle other header types + bne load_tape_normal_header // XXX also handle other header types, see Mapping the C64 page 77 // Handle the header @@ -109,11 +111,10 @@ load_tape_normal_header_loop: // this strange loop puts metadata after // FALLTROUGH +load_tape_normal_payload: - lda #$00 - sta ROPRTY // initialize EOR checksum XXX is it needed here? // XXX replace this placeholder with a real routine !: diff --git a/c64/kernal/tape/load_tape_turbo.s b/c64/kernal/tape/load_tape_turbo.s index a1c82b5c..eae97205 100644 --- a/c64/kernal/tape/load_tape_turbo.s +++ b/c64/kernal/tape/load_tape_turbo.s @@ -8,6 +8,8 @@ // XXX use calibration bits to improve reading +// XXX find out how to use B0 tape timing +// XXX put header type into (TAPE1) #if CONFIG_TAPE_TURBO @@ -38,24 +40,25 @@ load_tape_turbo_header: // 1 byte (skipped) - file type (0 = data, odd value = relocatable, even value = non-relocatable) // 2 bytes - start address // 2 bytes - end address + 1 - // 1 byte - if $0B (tape timing) contained at the time of saving + // 1 byte - if $B0 (tape timing) contained at the time of saving + // (we skip this one to match normal system header) // 16 bytes - filename, padded with 0x20 jsr tape_turbo_sync_header - ldy #$10 + ldy #$01 // to match original ROM header layout // FALLTROUGH -load_tape_turbo_header_loop: // this strange loop puts metadata after file name +load_tape_turbo_header_loop: jsr tape_turbo_get_byte sta (TAPE1), y iny - cpy #$15 + cpy #$05 bne !+ - ldy #$00 + jsr tape_turbo_get_byte // tape timing - skip this XXX how to use it? !: - cpy #$10 + cpy #$15 bne load_tape_turbo_header_loop // Handle the header diff --git a/c64/kernal/tape/tape_common.s b/c64/kernal/tape/tape_common.s index 9a630bb0..daf95cb0 100644 --- a/c64/kernal/tape/tape_common.s +++ b/c64/kernal/tape/tape_common.s @@ -147,12 +147,12 @@ tape_handle_header: ldx #__MSG_KERNAL_FOUND jsr print_kernal_message - ldy #$00 + ldy #$05 !: lda (TAPE1), y jsr JCHROUT iny - cpy #$10 + cpy #$15 bne !- // Header, wait for user decision @@ -167,7 +167,7 @@ tape_handle_header: // Setup STAL and EAL - ldy #$10 + ldy #$01 lda (TAPE1), y sta STAL+0