various turbo tape improvements
This commit is contained in:
1 parent
982b287e92
commit
ae80e9a596
19 files changed
+187
-50
No files matched your search
@@ -9,7 +9,7 @@
|
||||
|
||||
// XXX use calibration bits to improve reading
|
||||
// XXX handle load address from Kernal API
|
||||
// XXX add name matching
|
||||
// XXX finish pattern matching
|
||||
|
||||
|
||||
#if CONFIG_TAPE_TURBO
|
||||
@@ -32,14 +32,15 @@ load_tape_turbo_header:
|
||||
|
||||
// Read file header
|
||||
|
||||
jsr tape_turbo_sync
|
||||
jsr tape_turbo_sync_header
|
||||
|
||||
ldy #$15
|
||||
ldy #$00
|
||||
!:
|
||||
jsr tape_turbo_get_byte
|
||||
sta (TAPE1), y
|
||||
dey
|
||||
bpl !-
|
||||
iny
|
||||
cpy #$15
|
||||
bne !-
|
||||
|
||||
jsr tape_handle_header
|
||||
bcs load_tape_turbo_header // if name does not match, look for other header
|
||||
@@ -50,7 +51,7 @@ load_tape_turbo_payload:
|
||||
|
||||
// Read file payload
|
||||
|
||||
jsr tape_turbo_sync // .X gets set to 0
|
||||
jsr tape_turbo_sync_payload
|
||||
|
||||
ldy #$00
|
||||
sty PRTY // initial checksum value
|
||||
@@ -121,23 +122,43 @@ tape_turbo_get_bit:
|
||||
lsr
|
||||
rts
|
||||
|
||||
|
||||
tape_turbo_sync:
|
||||
tape_turbo_sync_common:
|
||||
|
||||
jsr tape_turbo_get_bit
|
||||
rol ROPRTY
|
||||
lda ROPRTY
|
||||
cmp #$02
|
||||
bne tape_turbo_sync
|
||||
rol ROPRTY
|
||||
lda ROPRTY
|
||||
cmp #$02
|
||||
bne tape_turbo_sync_common
|
||||
rts
|
||||
|
||||
tape_turbo_sync_header:
|
||||
|
||||
ldx #$FF
|
||||
!:
|
||||
ldy #$03
|
||||
!:
|
||||
jsr tape_turbo_sync_common
|
||||
dey
|
||||
bne !-
|
||||
dex
|
||||
bne !--
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
tape_turbo_sync_payload:
|
||||
|
||||
jsr tape_turbo_sync_common
|
||||
!:
|
||||
ldx #$09 // 9,8,... is real turboTape
|
||||
!: // I sometimes used 8,7,6... to avoid it being listed in vice :)
|
||||
jsr tape_turbo_get_byte
|
||||
cmp #$02
|
||||
beq !-
|
||||
ldy #$00
|
||||
!:
|
||||
cpx ROPRTY
|
||||
bne tape_turbo_sync
|
||||
jsr tape_turbo_get_byte
|
||||
bne tape_turbo_sync_payload
|
||||
jsr tape_turbo_get_byte
|
||||
dex
|
||||
bne !-
|
||||
|
||||
|
||||
@@ -22,6 +22,18 @@ tape_ditch_verify:
|
||||
jmp lvs_device_not_found_error
|
||||
|
||||
|
||||
//
|
||||
// Loading terminated by user
|
||||
//
|
||||
|
||||
tape_break_error:
|
||||
|
||||
pla
|
||||
pla
|
||||
cli
|
||||
jmp kernalerror_ROUTINE_TERMINATED
|
||||
|
||||
|
||||
//
|
||||
// Handle tape deck motor
|
||||
//
|
||||
@@ -92,13 +104,8 @@ tape_wait_play_loop:
|
||||
|
||||
jsr udtim_keyboard
|
||||
jsr STOP
|
||||
bcc !+
|
||||
bcs tape_break_error
|
||||
|
||||
// Stop key pressed
|
||||
pla
|
||||
pla
|
||||
cli
|
||||
jmp kernalerror_ROUTINE_TERMINATED
|
||||
!:
|
||||
lda CPU_R6510
|
||||
and #$10 // check for pressed button
|
||||
@@ -118,49 +125,52 @@ tape_handle_header:
|
||||
// Header structure described here:
|
||||
// - https://www.luigidifraia.com/c64/docs/tapeloaders.html#turbotape64
|
||||
//
|
||||
// 1 byte - 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 XXX handle this
|
||||
// 16 bytes - filename, padded with 0x20
|
||||
//
|
||||
// Out tape buffer contains header in reversed order
|
||||
// 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
|
||||
// 16 bytes - filename, padded with 0x20
|
||||
|
||||
// Print FOUND + file name
|
||||
|
||||
ldx #__MSG_KERNAL_FOUND
|
||||
jsr print_kernal_message
|
||||
|
||||
ldy #$10
|
||||
ldy #$05
|
||||
!:
|
||||
lda (TAPE1), y
|
||||
jsr JCHROUT
|
||||
dey
|
||||
bpl !-
|
||||
iny
|
||||
cpy #$15
|
||||
bne !-
|
||||
jsr print_return
|
||||
|
||||
// Header, wait for user decision
|
||||
|
||||
jsr tape_header_get_decision
|
||||
bcs tape_break_error
|
||||
|
||||
// Check if file name matches
|
||||
|
||||
/* XXX does not work yet
|
||||
jsr tape_match_filename
|
||||
bcs tape_handle_header_skip
|
||||
|
||||
// XXX Perform filename matching
|
||||
|
||||
*/
|
||||
// Setup STAL and EAL
|
||||
|
||||
ldy #$15
|
||||
ldy #$00
|
||||
lda (TAPE1), y
|
||||
sta STAL+0
|
||||
|
||||
dey
|
||||
iny
|
||||
lda (TAPE1), y
|
||||
sta STAL+1
|
||||
|
||||
dey
|
||||
iny
|
||||
lda (TAPE1), y
|
||||
sta EAL+0
|
||||
|
||||
dey
|
||||
iny
|
||||
lda (TAPE1), y
|
||||
sta EAL+1
|
||||
|
||||
@@ -172,6 +182,10 @@ tape_handle_header:
|
||||
|
||||
jsr tape_screen_hide_motor_on
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
tape_return_ok:
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
@@ -181,10 +195,47 @@ tape_handle_header_skip:
|
||||
|
||||
jsr tape_screen_hide_motor_on
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
tape_return_not_ok:
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
//
|
||||
// Check whether file name matches the pattern
|
||||
//
|
||||
/* XXX does not work yet
|
||||
tape_match_filename:
|
||||
|
||||
lda FNLEN
|
||||
beq tape_return_ok // no pattern to match
|
||||
|
||||
ldy $00
|
||||
|
||||
tape_match_loop:
|
||||
|
||||
lda #$20 // default byte, for padding
|
||||
cpy FNLEN
|
||||
beq !+ // end of pattern
|
||||
lda (FNADDR), y // byte from pattern
|
||||
!:
|
||||
.break
|
||||
cmp #KEY_ASTERISK
|
||||
beq tape_return_ok
|
||||
|
||||
cmp (TAPE1 + 5),y
|
||||
bne tape_return_not_ok
|
||||
|
||||
iny
|
||||
cpy #$10
|
||||
bne tape_match_loop
|
||||
|
||||
clc
|
||||
rts
|
||||
*/
|
||||
|
||||
//
|
||||
// Get user decision whether to load the file or not
|
||||
//
|
||||
@@ -228,6 +279,7 @@ tape_load_success:
|
||||
|
||||
jsr tape_screen_show_motor_off
|
||||
jsr lvs_display_done
|
||||
jsr print_return
|
||||
|
||||
cli
|
||||
jmp lvs_success_end
|
||||
|
||||
Reference in new issue
Block a user