diff --git a/CONFIG.md b/CONFIG.md index 409511a4..13afd09b 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -163,6 +163,12 @@ Enable this option if you are using a tape interface adapter with some audio sig Enable this option if you are using a tape interface adapter lacking tape motor control (most likely every adapter currently being sold) - this will eliminate the need to quickly press space when the program header information gets displayed. Note: if you are using a cassette player with REM port, and your adapter is connected to this port too, than you do not need this option. +### `CONFIG_TAPE_NO_ERROR_CORRECTION` + +Normal tape format contains two copies of each data block - in case some bytes from the first one are damaged, they can be corrected by reading them from the second copy. Enabling this option omits the core to read the second block. + +If using real magnetic tape - disable. Enable if only using Tapuino or other tape emulators. + ## Multiple SID support The SID is a sound chip - original machine had one installed. However, mods exists to add more of them for improved sound capabilitiee. Emulators and FPGA machines typically allow to simulate more than one too. Unfortunately, there is no standard regarding how these additional chips are visible in the processor address space, and there is no sane way to detect it - thus, it has to be configurable. diff --git a/STATUS.md b/STATUS.md index 61d0306d..d4891fe6 100644 --- a/STATUS.md +++ b/STATUS.md @@ -12,7 +12,8 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * DOS wedge (direct mode only) - `@`, `@`, `@$`, `@$`, `@` * turbo tape load support (as device 7, or using `←L`), quite sophisticated: up to 250 blocks (can store bytes under I/O), automatically adjusts for tape speed differences -* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) +* normal tape load error log is limited by free stack space only (no artificial limitation like in original ROMs) +* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style @@ -69,7 +70,7 @@ The following ROM features are currently missing: | Driver | Status | Remarks | | :----------------: | :------: | :------------------------------------------------: | -| normal | PARTIAL | no error correction (work in progress) | +| normal | DONE | | | turbo (250 blocks) | DONE | | ## IEC bus diff --git a/c64/,,config_custom.s b/c64/,,config_custom.s index 22206333..6e5787e8 100644 --- a/c64/,,config_custom.s +++ b/c64/,,config_custom.s @@ -50,18 +50,19 @@ #define CONFIG_IEC_DOLPHINDOS_FAST #define CONFIG_IEC_JIFFYDOS #define CONFIG_IEC_JIFFYDOS_BLANK -// #define CONFIG_IEC_BURST_CIA1 // please keep disabled for now -// #define CONFIG_IEC_BURST_CIA2 // please keep disabled for now -// #define CONFIG_IEC_BURST_SOFT // please keep disabled for now +// #define CONFIG_IEC_BURST_CIA1 // please keep disabled for now +// #define CONFIG_IEC_BURST_CIA2 // please keep disabled for now +// #define CONFIG_IEC_BURST_SOFT // please keep disabled for now #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO -#define CONFIG_TAPE_AUTODETECT // mostly works, but not fully done yet! +#define CONFIG_TAPE_AUTODETECT // mostly works, but not fully done yet! // #define CONFIG_TAPE_NO_KEY_SENSE // #define CONFIG_TAPE_NO_MOTOR_CONTROL +// #define CONFIG_TAPE_NO_ERROR_CORRECTION -// #define CONFIG_RS232_UP2400 // please keep disabled for now -// #define CONFIG_RS232_UP9600 // please keep disabled for now +// #define CONFIG_RS232_UP2400 // please keep disabled for now +// #define CONFIG_RS232_UP9600 // please keep disabled for now // Multiple SID support diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index ef1c11d6..86516d96 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -48,10 +48,11 @@ #define CONFIG_IEC_JIFFYDOS #define CONFIG_IEC_JIFFYDOS_BLANK -// #define CONFIG_TAPE_NORMAL +#define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO // #define CONFIG_TAPE_NO_KEY_SENSE // #define CONFIG_TAPE_NO_MOTOR_CONTROL +#define CONFIG_TAPE_NO_ERROR_CORRECTION // Multiple SID support diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index add9c08e..b498a38a 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -52,6 +52,7 @@ // #define CONFIG_TAPE_TURBO // #define CONFIG_TAPE_NO_KEY_SENSE // #define CONFIG_TAPE_NO_MOTOR_CONTROL +#define CONFIG_TAPE_NO_ERROR_CORRECTION // Multiple SID support diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index 0f7a164f..537fcded 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -52,6 +52,7 @@ #define CONFIG_TAPE_TURBO // #define CONFIG_TAPE_NO_KEY_SENSE // #define CONFIG_TAPE_NO_MOTOR_CONTROL +#define CONFIG_TAPE_NO_ERROR_CORRECTION // Multiple SID support diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index f2927c60..6293096d 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -52,6 +52,7 @@ #define CONFIG_TAPE_TURBO // #define CONFIG_TAPE_NO_KEY_SENSE // #define CONFIG_TAPE_NO_MOTOR_CONTROL +#define CONFIG_TAPE_NO_ERROR_CORRECTION // Multiple SID support diff --git a/c64/kernal/tape/tape_normal_get_data_1.s b/c64/kernal/tape/tape_normal_get_data_1.s index 09ab2c7c..ac3353aa 100644 --- a/c64/kernal/tape/tape_normal_get_data_1.s +++ b/c64/kernal/tape/tape_normal_get_data_1.s @@ -21,8 +21,10 @@ tape_normal_get_data_1: // and pointers for error log and correction mechanism lda #$00 sta RIPRTY +#if !CONFIG_TAPE_NO_ERROR_CORRECTION sta PTR1 sta PTR2 +#endif // FALLTROUGH @@ -43,6 +45,12 @@ tape_normal_get_data_1_loop: jsr tape_normal_get_byte bcc tape_normal_get_data_1_loop_byte_OK +#if CONFIG_TAPE_NO_ERROR_CORRECTION + + bcs tape_normal_get_data_1_fail + +#else + // Problem reading a byte, try to add it to the error log tsx @@ -56,13 +64,15 @@ tape_normal_get_data_1_loop: lda MEMUSS+1 sta STACK, x inx - sta PTR1 + stx PTR1 // Addres added to error log, check if this was a checksum jsr tape_normal_get_marker bcc tape_normal_get_data_1_loop_advance bcs tape_normal_get_data_1_success +#endif + tape_normal_get_data_1_loop_byte_OK: jsr tape_normal_get_marker diff --git a/c64/kernal/tape/tape_normal_get_data_2.s b/c64/kernal/tape/tape_normal_get_data_2.s index 85f89fef..2c378473 100644 --- a/c64/kernal/tape/tape_normal_get_data_2.s +++ b/c64/kernal/tape/tape_normal_get_data_2.s @@ -9,20 +9,27 @@ #if CONFIG_TAPE_NORMAL -tape_normal_get_data_2: - +#if CONFIG_TAPE_NO_ERROR_CORRECTION + + +tape_normal_get_data_2: // XXX implement under separate name + + // Just validate the checksum + lda RIPRTY cmp #$01 rts -#elif XXX_DISABLED + +#else + tape_normal_get_data_2: // First check if there is a need to read anything - // XXX lda PTR1 - // XXX beq tape_normal_get_data_2_checksum + lda PTR1 + beq tape_normal_get_data_2_log_checksum // Read sync of the block @@ -40,25 +47,21 @@ tape_normal_get_data_2_loop: jsr tape_normal_get_byte bcc tape_normal_get_data_2_loop_byte_OK - // Problem reading byte + // Problem reading a byte - just skip it - jsr load_cmp_log_MEMUSS - bne tape_normal_get_data_2_loop_advance - - sec - rts + bcs tape_normal_get_data_2_loop_advance tape_normal_get_data_2_loop_byte_OK: jsr load_cmp_log_MEMUSS - beq tape_normal_get_data_2_loop_byte_correct // branch if byte from the log + beq tape_normal_get_data_2_loop_from_log // branch if byte from the log jsr tape_normal_get_marker bcs tape_normal_get_data_2_log_checksum // branch if end of blocks bcc tape_normal_get_data_2_loop_advance -tape_normal_get_data_2_loop_byte_correct: +tape_normal_get_data_2_loop_from_log: // This is a byte from the log @@ -132,3 +135,6 @@ load_cmp_log_MEMUSS: #endif + + +#endif diff --git a/testsuite/testtape-c64-pal-normal-errors.tap b/testsuite/testtape-c64-pal-normal-errors.tap new file mode 100644 index 00000000..0e103e44 Binary files /dev/null and b/testsuite/testtape-c64-pal-normal-errors.tap differ