fiurst step towards reading second copy of tap[e files
This commit is contained in:
1 parent
e9b9767a71
commit
0ff947ca1d
4 files changed
+109
-35
No files matched your search
@@ -69,7 +69,7 @@ The following ROM features are currently missing:
|
|||||||
|
|
||||||
| Driver | Status | Remarks |
|
| Driver | Status | Remarks |
|
||||||
| :----------------: | :------: | :------------------------------------------------: |
|
| :----------------: | :------: | :------------------------------------------------: |
|
||||||
| normal | PARTIAL | no tape speed calibratrion, no error correction |
|
| normal | PARTIAL | no error correction (work in progress) |
|
||||||
| turbo (250 blocks) | DONE | |
|
| turbo (250 blocks) | DONE | |
|
||||||
|
|
||||||
## IEC bus
|
## IEC bus
|
||||||
|
|||||||
@@ -100,8 +100,8 @@
|
|||||||
.label COLSTORE = $9C // [!] screen border storage for tape routines
|
.label COLSTORE = $9C // [!] screen border storage for tape routines
|
||||||
#endif
|
#endif
|
||||||
.label MSGFLG = $9D // bit 6 = error messages, bit 7 = control message
|
.label MSGFLG = $9D // bit 6 = error messages, bit 7 = control message
|
||||||
.label PTR1 = $9E // -- NOT IMPLEMENTED --
|
.label PTR1 = $9E // for tape support, counter of errorneous bytes
|
||||||
.label PTR2 = $9F // -- NOT IMPLEMENTED --
|
.label PTR2 = $9F // for tape support, counter for errorneous bytes correction
|
||||||
.label TIME = $A0 // $A0-$A2 jiffy clock
|
.label TIME = $A0 // $A0-$A2 jiffy clock
|
||||||
#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT
|
#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT
|
||||||
.label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs
|
.label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ load_tape_normal_header:
|
|||||||
// Retrieve the header
|
// Retrieve the header
|
||||||
|
|
||||||
jsr tape_normal_get_pilot_header
|
jsr tape_normal_get_pilot_header
|
||||||
ldy #$C1 // size limit (including checksum)
|
|
||||||
jsr tape_normal_get_data
|
jsr tape_normal_get_data
|
||||||
bcs load_tape_normal_header // unable to read block, try again XXX restore MEMUSS and jump to turbo detection
|
bcs load_tape_normal_header // unable to read block, try again XXX restore MEMUSS and jump to turbo detection
|
||||||
|
|
||||||
@@ -97,17 +96,9 @@ load_tape_normal_header:
|
|||||||
lda #$01
|
lda #$01
|
||||||
sta SA // this file is non-relocatable; override secondary address with 1
|
sta SA // this file is non-relocatable; override secondary address with 1
|
||||||
!:
|
!:
|
||||||
// Handle the header
|
// Restore MEMUSS, handle header
|
||||||
|
|
||||||
// Restore MEMUSS
|
|
||||||
|
|
||||||
lda EAL+1
|
|
||||||
sta MEMUSS+1
|
|
||||||
lda EAL+0
|
|
||||||
sta MEMUSS+0
|
|
||||||
|
|
||||||
// Handle the header
|
|
||||||
|
|
||||||
|
jsr load_tape_normal_restore_MEMUSS
|
||||||
jsr tape_handle_header
|
jsr tape_handle_header
|
||||||
bcs load_tape_normal_header // if name does not match, look for other header
|
bcs load_tape_normal_header // if name does not match, look for other header
|
||||||
|
|
||||||
@@ -128,4 +119,14 @@ load_tape_normal_payload:
|
|||||||
jmp tape_load_success
|
jmp tape_load_success
|
||||||
|
|
||||||
|
|
||||||
|
load_tape_normal_restore_MEMUSS:
|
||||||
|
|
||||||
|
lda EAL+1
|
||||||
|
sta MEMUSS+1
|
||||||
|
lda EAL+0
|
||||||
|
sta MEMUSS+0
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -17,33 +17,73 @@
|
|||||||
|
|
||||||
tape_normal_get_data:
|
tape_normal_get_data:
|
||||||
|
|
||||||
// Store block size limit
|
|
||||||
sty XSAV
|
|
||||||
|
|
||||||
// Initialize checksum (RIPRTY, see http://sta.c64.org/cbm64mem.html)
|
// Initialize checksum (RIPRTY, see http://sta.c64.org/cbm64mem.html)
|
||||||
|
// and pointers for error log and correction mechanism
|
||||||
lda #$00
|
lda #$00
|
||||||
sta RIPRTY
|
sta RIPRTY
|
||||||
|
sta PTR1
|
||||||
|
sta PTR2
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
tape_normal_get_data_block_1:
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read the 1st copy of the block
|
||||||
|
//
|
||||||
|
|
||||||
// Read sync of the block
|
// Read sync of the block
|
||||||
ldy #$89
|
ldy #$89
|
||||||
jsr tape_normal_sync
|
jsr tape_normal_sync
|
||||||
bcs tape_normal_get_block_done
|
bcs tape_normal_get_data_fail
|
||||||
jsr tape_normal_get_marker
|
jsr tape_normal_get_marker
|
||||||
|
|
||||||
tape_normal_get_data_loop:
|
tape_normal_get_data_loop_1:
|
||||||
|
|
||||||
jsr tape_normal_get_byte
|
jsr tape_normal_get_byte
|
||||||
bcs tape_normal_get_block_done // error reading byte - fatal for now
|
bcc tape_normal_get_data_loop_1_byte_OK
|
||||||
jsr tape_normal_get_marker
|
|
||||||
bcs tape_normal_get_checksum // end of data for the block
|
// Problem reading a byte, try to add it to the error log
|
||||||
|
|
||||||
|
tsx
|
||||||
|
cpx #$20 // just to be on a safe side
|
||||||
|
bcc tape_normal_get_data_fail // branch if no more space in error log
|
||||||
|
|
||||||
|
ldx PTR1
|
||||||
|
lda MEMUSS+0
|
||||||
|
sta STACK, x
|
||||||
|
inx
|
||||||
|
lda MEMUSS+1
|
||||||
|
sta STACK, x
|
||||||
|
inx
|
||||||
|
sta PTR1
|
||||||
|
|
||||||
|
// Addres added to error log, check if this was a checksum
|
||||||
|
jsr tape_normal_get_marker
|
||||||
|
bcc tape_normal_get_data_loop_1_advance
|
||||||
|
bcs tape_normal_get_data_block_2
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_get_data_loop_1_byte_OK:
|
||||||
|
|
||||||
|
jsr tape_normal_get_marker
|
||||||
|
bcc !+
|
||||||
|
|
||||||
|
// End of the block
|
||||||
|
jsr tape_normal_update_checksum
|
||||||
|
jmp tape_normal_get_data_block_2
|
||||||
|
|
||||||
|
!:
|
||||||
// Store byte, calculate checksum
|
// Store byte, calculate checksum
|
||||||
lda INBIT
|
lda INBIT
|
||||||
ldy #$00
|
ldy #$00
|
||||||
sta (MEMUSS), y
|
sta (MEMUSS), y
|
||||||
eor RIPRTY
|
jsr tape_normal_update_checksum
|
||||||
sta RIPRTY
|
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
tape_normal_get_data_loop_1_advance:
|
||||||
|
|
||||||
// Advance pointer
|
// Advance pointer
|
||||||
#if !HAS_OPCODES_65CE02
|
#if !HAS_OPCODES_65CE02
|
||||||
jsr lvs_advance_MEMUSS
|
jsr lvs_advance_MEMUSS
|
||||||
@@ -51,26 +91,59 @@ tape_normal_get_data_loop:
|
|||||||
inw MEMUSS+0
|
inw MEMUSS+0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check block length limit
|
jmp tape_normal_get_data_loop_1
|
||||||
lda XSAV
|
|
||||||
beq tape_normal_get_data_loop // no limit requested
|
|
||||||
dec XSAV
|
|
||||||
bne tape_normal_get_data_loop
|
|
||||||
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
|
|
||||||
tape_normal_get_checksum: // XXX handle second copy, with pilot starting from $09
|
tape_normal_get_data_block_2:
|
||||||
|
|
||||||
lda INBIT
|
//
|
||||||
eor RIPRTY
|
// Read the 2nd copy of the block
|
||||||
|
//
|
||||||
|
|
||||||
|
// First check if there is a need to read anything
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
|
||||||
|
// Read sync of the block
|
||||||
|
ldy #$09
|
||||||
|
jsr tape_normal_sync
|
||||||
|
bcs tape_normal_get_data_fail
|
||||||
|
jsr tape_normal_get_marker
|
||||||
|
|
||||||
|
// XXX implement the second pass
|
||||||
|
|
||||||
|
|
||||||
|
lda PTR1
|
||||||
|
beq tape_normal_get_data_checksum
|
||||||
|
|
||||||
|
jmp tape_normal_get_data_fail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_get_data_checksum:
|
||||||
|
|
||||||
|
lda RIPRTY
|
||||||
cmp #$01 // sets Carry if checksum verification fails
|
cmp #$01 // sets Carry if checksum verification fails
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
tape_normal_get_block_done:
|
tape_normal_get_data_done:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
tape_normal_get_data_fail:
|
||||||
|
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_update_checksum:
|
||||||
|
|
||||||
|
lda INBIT
|
||||||
|
eor RIPRTY
|
||||||
|
sta RIPRTY
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user