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
@@ -169,6 +169,9 @@
|
|||||||
#if CONFIG_LEGACY_SCNKEY && CONFIG_RS232_UP9600
|
#if CONFIG_LEGACY_SCNKEY && CONFIG_RS232_UP9600
|
||||||
.error "CONFIG_LEGACY_SCNKEY is not compatible with CONFIG_RS232_UP9600"
|
.error "CONFIG_LEGACY_SCNKEY is not compatible with CONFIG_RS232_UP9600"
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_LEGACY_SCNKEY && CONFIG_TAPE_NORMAL
|
||||||
|
.error "CONFIG_LEGACY_SCNKEY is not compatible with CONFIG_TAPE_NORMAL"
|
||||||
|
#endif
|
||||||
#if CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
|
#if CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
|
||||||
.error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128* / CONFIG_KEYBOARD_C65* are mutually exclusive"
|
.error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128* / CONFIG_KEYBOARD_C65* are mutually exclusive"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
.label BITCI = $A8 // -- NOT IMPLEMENTED --
|
.label BITCI = $A8 // -- NOT IMPLEMENTED --
|
||||||
.label RINONE = $A9 // -- WIP -- (UP9600 only) RS-232 check for start bit flag
|
.label RINONE = $A9 // -- WIP -- (UP9600 only) RS-232 check for start bit flag
|
||||||
.label RIDDATA = $AA // -- NOT IMPLEMENTED --
|
.label RIDDATA = $AA // -- NOT IMPLEMENTED --
|
||||||
.label RIPRTY = $AB // -- NOT IMPLEMENTED --
|
.label RIPRTY = $AB // -- WIP -- checksum while reading tape
|
||||||
#endif
|
#endif
|
||||||
.label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part)
|
.label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part)
|
||||||
.label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling
|
.label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ lvs_setup_MEMUSS:
|
|||||||
sta MEMUSS+1
|
sta MEMUSS+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_TURBO || CONFIG_IEC
|
||||||
|
|
||||||
lvs_advance_MEMUSS_check_EAL:
|
lvs_advance_MEMUSS_check_EAL:
|
||||||
|
|
||||||
// Advance pointer
|
// Advance pointer
|
||||||
@@ -95,7 +99,15 @@ lvs_advance_MEMUSS_check_EAL:
|
|||||||
!:
|
!:
|
||||||
#else
|
#else
|
||||||
inw MEMUSS+0
|
inw MEMUSS+0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO || CONFIG_IEC
|
||||||
|
|
||||||
|
lvs_check_EAL:
|
||||||
|
|
||||||
lda MEMUSS+1
|
lda MEMUSS+1
|
||||||
cmp EAL+1
|
cmp EAL+1
|
||||||
bne !+
|
bne !+
|
||||||
|
|||||||
@@ -117,18 +117,24 @@ load_tape_normal_header_loop:
|
|||||||
|
|
||||||
load_tape_normal_payload:
|
load_tape_normal_payload:
|
||||||
|
|
||||||
jsr tape_normal_pilot
|
// Retrieve block
|
||||||
ldy #$09
|
|
||||||
jsr tape_normal_sync
|
|
||||||
|
|
||||||
|
jsr tape_normal_get_block // XXX handle errors
|
||||||
|
|
||||||
|
// Advance MEMUSS (see Mapping the C64, page 36), check if end
|
||||||
|
|
||||||
|
tya
|
||||||
// XXX replace this placeholder with a real routine
|
clc
|
||||||
|
adc MEMUSS+0
|
||||||
|
sta MEMUSS+0
|
||||||
|
bcc !+
|
||||||
|
inc MEMUSS+1
|
||||||
!:
|
!:
|
||||||
jsr tape_normal_get_marker
|
|
||||||
jsr tape_normal_get_byte
|
jsr lvs_check_EAL
|
||||||
jmp !-
|
bne load_tape_normal_payload
|
||||||
|
|
||||||
|
jmp tape_load_success
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#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
|
// 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