LOAD for normal (standard system) tapes works, still needs a lot of work

This commit is contained in:
FeralChild64 committed 2019-12-24 16:38:05 +01:00
1 parent dc00b3cc6b
commit c497e3b03c
18 files changed
+134 -89

No files matched your search

+2 -1
View File
@@ -11,6 +11,7 @@
// - file contains options to enable unfinished functionalities
// Hardware platform and brand
#define CONFIG_PLATFORM_COMMODORE_64
@@ -48,7 +49,7 @@
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
#define CONFIG_TAPE_NORMAL // not finished yet!
#define CONFIG_TAPE_NORMAL
#define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
+2
View File
@@ -11,6 +11,7 @@
// - do not enable features which are a significant compatibility risk
// Hardware platform and brand
#define CONFIG_PLATFORM_COMMODORE_64
@@ -44,6 +45,7 @@
#define CONFIG_IEC_BLANK_SCREEN
#define CONFIG_IEC_JIFFYDOS
#define CONFIG_TAPE_NORMAL
#define CONFIG_TAPE_TURBO
+2
View File
@@ -11,6 +11,7 @@
// - do not enable features which are a significant compatibility risk
// Hardware platform and brand
#define CONFIG_PLATFORM_COMMODORE_64
@@ -44,6 +45,7 @@
#define CONFIG_IEC_BLANK_SCREEN
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL
// #define CONFIG_TAPE_TURBO
+1 -5
View File
@@ -43,15 +43,11 @@
#define CONFIG_IEC
// #define CONFIG_IEC_BLANK_SCREEN
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_NORMAL
#define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
// Multiple SID support
+2 -1
View File
@@ -11,6 +11,7 @@
// - do not enable features which are a significant compatibility risk
// Hardware platform and brand
#define CONFIG_PLATFORM_COMMODORE_64
@@ -44,10 +45,10 @@
#define CONFIG_IEC_BLANK_SCREEN
#define CONFIG_IEC_JIFFYDOS
#define CONFIG_TAPE_NORMAL
#define CONFIG_TAPE_TURBO
// Multiple SID support
// #define CONFIG_SID_2ND
+2 -2
View File
@@ -297,13 +297,13 @@
.var features_str = ""
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL-DEV")
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL")
#endif
#if !CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD TURBO")
#endif
#if CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL-DEV TURBO")
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL TURBO")
#endif
.eval feature_new_line = true
+36 -5
View File
@@ -63,6 +63,31 @@ load_tape_normal:
load_tape_normal_header:
/* XXX try to reuse block retrieeval rooutine, like this:
// Try to load header into tape buffer
lda TAPE1+1
sta MEMUSS+1
lda TAPE1+0
sta MEMUSS+0
// Initialize checksum (RIPRTY, see http://sta.c64.org/cbm64mem.html)
lda #$00
sta RIPRTY
// Retrieve the header XXX limit it to 192 bytes
jsr tape_normal_get_block
bcs load_tape_normal_header // unable to read block, try again
// Handle the header
jsr tape_handle_header
bcs load_tape_normal_header // if name does not match, look for other header
*/
// Read pilot and sync of the first header
jsr tape_normal_pilot
@@ -117,9 +142,15 @@ load_tape_normal_header_loop:
load_tape_normal_payload:
// Retrieve block
// Initialize checksum (RIPRTY, see http://sta.c64.org/cbm64mem.html)
lda #$00
sta RIPRTY
jsr tape_normal_get_block // XXX handle errors
// Retrieve data
jsr tape_normal_get_data
bcs_far tape_load_error
// Advance MEMUSS (see Mapping the C64, page 36), check if end
@@ -130,9 +161,9 @@ load_tape_normal_payload:
bcc !+
inc MEMUSS+1
!:
jsr lvs_check_EAL
bne load_tape_normal_payload
// XXX check below does not work - why?
// jsr lvs_check_EAL
// bne_far tape_load_error // amount of data read does not match header info
jmp tape_load_success
-74
View File
@@ -1,74 +0,0 @@
//
// 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
+80
View File
@@ -0,0 +1,80 @@
//
// Tape (normal) helper routine - data block reading
//
// Stores data starting from MEMUSS, Carry set means error, on 0 bit .A is 0 too
//
// XXX improve error handling - do not ignore second copy, handle damaged sync part
#if CONFIG_TAPE_NORMAL
tape_normal_get_data:
// Read the pilot and sync of the block
jsr tape_normal_pilot
ldy #$89
jsr tape_normal_sync
bcs tape_normal_get_block_done // XXX make it more erroor resistant
// Initialize byte counter
ldy #$00
tape_normal_get_data_loop:
jsr tape_normal_get_marker
bcs tape_normal_get_data_2nd_copy // 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_data_loop
// 256 bytes read
inc MEMUSS+1
jmp tape_normal_get_data_loop
tape_normal_get_data_2nd_copy:
// Read the pilot and sync of the block
jsr tape_normal_pilot
ldy #$09
jsr tape_normal_sync
bcs tape_normal_get_block_done // XXX make it more error resistant
// For now skip the error correction data
!:
jsr tape_normal_get_marker
bcs tape_normal_get_checksum
jsr tape_normal_get_byte
tay
jmp !-
tape_normal_get_checksum:
tya
eor RIPRTY
cmp #$01 // sets Carry if checksum verification failed
clc // XXX checksum calculation fails - why?
// FALLTROUGH
tape_normal_get_block_done:
rts
#endif