tape normal block reading added
This commit is contained in:
1 parent
9b2d01354b
commit
dc00b3cc6b
6 files changed
+105
-10
No files matched your search
@@ -85,6 +85,10 @@ lvs_setup_MEMUSS:
|
||||
sta MEMUSS+1
|
||||
rts
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_TAPE_TURBO || CONFIG_IEC
|
||||
|
||||
lvs_advance_MEMUSS_check_EAL:
|
||||
|
||||
// Advance pointer
|
||||
@@ -95,7 +99,15 @@ lvs_advance_MEMUSS_check_EAL:
|
||||
!:
|
||||
#else
|
||||
inw MEMUSS+0
|
||||
|
||||
#endif
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO || CONFIG_IEC
|
||||
|
||||
lvs_check_EAL:
|
||||
|
||||
lda MEMUSS+1
|
||||
cmp EAL+1
|
||||
bne !+
|
||||
|
||||
@@ -117,18 +117,24 @@ load_tape_normal_header_loop:
|
||||
|
||||
load_tape_normal_payload:
|
||||
|
||||
jsr tape_normal_pilot
|
||||
ldy #$09
|
||||
jsr tape_normal_sync
|
||||
// Retrieve block
|
||||
|
||||
jsr tape_normal_get_block // XXX handle errors
|
||||
|
||||
// Advance MEMUSS (see Mapping the C64, page 36), check if end
|
||||
|
||||
|
||||
// XXX replace this placeholder with a real routine
|
||||
tya
|
||||
clc
|
||||
adc MEMUSS+0
|
||||
sta MEMUSS+0
|
||||
bcc !+
|
||||
inc MEMUSS+1
|
||||
!:
|
||||
jsr tape_normal_get_marker
|
||||
jsr tape_normal_get_byte
|
||||
jmp !-
|
||||
|
||||
jsr lvs_check_EAL
|
||||
bne load_tape_normal_payload
|
||||
|
||||
jmp tape_load_success
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
//
|
||||
// Tape (turbo) helper routine - bit reading
|
||||
// Tape (normal) helper routine - bit reading
|
||||
//
|
||||
// Returns bit in Zero flag, Carry set means error, on 0 bit .A is 0 too
|
||||
//
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
//
|
||||
// Tape (normal) helper routine - block reading
|
||||
//
|
||||
// Stores data starting from MEMUSS, Carry set means error, on 0 bit .A is 0 too
|
||||
//
|
||||
|
||||
|
||||
// XXX does not detect block end - find out why
|
||||
// XXX improve error handling - do not ignore second copy, handle damaged checksum byte, handle damaged sync part
|
||||
|
||||
|
||||
tape_normal_get_block:
|
||||
|
||||
// Read the pilot and sync of the block
|
||||
|
||||
jsr tape_normal_pilot
|
||||
ldy #$89
|
||||
jsr tape_normal_sync // XXX handle result
|
||||
|
||||
// Initialize byte counter and block checksum (RIPRTY, see http://sta.c64.org/cbm64mem.html)
|
||||
ldy #$00
|
||||
sty RIPRTY
|
||||
|
||||
tape_normal_get_block_loop:
|
||||
|
||||
jsr tape_normal_get_marker
|
||||
bcs tape_normal_get_block_checksum // end of data for the block
|
||||
jsr tape_normal_get_byte
|
||||
|
||||
bcs tape_normal_get_block_done // error reading byte - fatal for now
|
||||
|
||||
// Store byte, calculate checksum
|
||||
sta (MEMUSS), y
|
||||
eor RIPRTY
|
||||
sta RIPRTY
|
||||
|
||||
iny
|
||||
bne tape_normal_get_block_loop
|
||||
|
||||
// FALLTROUGH - if we are here, it means the block is too long
|
||||
|
||||
tape_normal_get_block_done_fail:
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
tape_normal_get_block_checksum:
|
||||
.break
|
||||
jsr tape_normal_get_byte
|
||||
bcs tape_normal_get_block_done // cannot get block checksum - fatal for now
|
||||
|
||||
eor RIPRTY
|
||||
cmp #$01
|
||||
bcs tape_normal_get_block_done // checksum error - fatal for now
|
||||
|
||||
// Read trailing pulses
|
||||
|
||||
jsr tape_normal_sync // XXX handle result
|
||||
|
||||
// Read the pilot and sync of the backup block
|
||||
|
||||
jsr tape_normal_pilot
|
||||
ldy #$09
|
||||
jsr tape_normal_sync // XXX handle result
|
||||
|
||||
// For now we ignore the backup block
|
||||
clc
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
tape_normal_get_block_done:
|
||||
|
||||
rts
|
||||
Reference in new issue
Block a user