diff --git a/CONFIG.md b/CONFIG.md index df65d62a..90d9b076 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -143,6 +143,14 @@ Adds a minimal turbo tape support - just LOAD command (device 7, like on _Action Needs about 650 bytes in KERNAL segment (if both normal and turbo are enabled, about 950 bytes are needed, as they share some code). If unsure - enable. +### `CONFIG_TAPE_NO_KEY_SENSE` + +Enable this option if you are using a tape interface adapter with some audio signal source connected. These adapters lack key sense functionality, so the computer is unable to tell whether Play got pressed or not - with this option ROM will assume Play got pressed after imppulses start arriving from the tape. + +### `CONFIG_TAPE_NO_MOTOR_CONTROL` + +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. + ## 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/Makefile b/Makefile index 6e5edbf5..1071b379 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Test files TESTDISK = testsuite/testdisk.d64 -TESTTAPE = testsuite/testtape-c64-pal-normal.tap +TESTTAPE = testsuite/testtape-c64-pal-turbo.tap # Source files diff --git a/STATUS.md b/STATUS.md index 865001d7..9787b0a2 100644 --- a/STATUS.md +++ b/STATUS.md @@ -13,6 +13,7 @@ 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`), up to 250 blocks (can store bytes under I/O) +* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style diff --git a/c64/,,config_custom.s b/c64/,,config_custom.s index 2911e68c..192d682a 100644 --- a/c64/,,config_custom.s +++ b/c64/,,config_custom.s @@ -55,6 +55,8 @@ #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO +// #define CONFIG_TAPE_NO_KEY_SENSE +// #define CONFIG_TAPE_NO_MOTOR_CONTROL // #define CONFIG_RS232_UP2400 // please keep disabled for now // #define CONFIG_RS232_UP9600 // please keep disabled for now diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 362566a3..84cd3ea7 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -49,6 +49,8 @@ #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO +// #define CONFIG_TAPE_NO_KEY_SENSE +// #define CONFIG_TAPE_NO_MOTOR_CONTROL // Multiple SID support diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 4c243094..99a7306c 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -49,6 +49,8 @@ // #define CONFIG_TAPE_NORMAL // #define CONFIG_TAPE_TURBO +// #define CONFIG_TAPE_NO_KEY_SENSE +// #define CONFIG_TAPE_NO_MOTOR_CONTROL // Multiple SID support diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index 4e910880..a3c38560 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -49,6 +49,8 @@ // #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO +// #define CONFIG_TAPE_NO_KEY_SENSE +// #define CONFIG_TAPE_NO_MOTOR_CONTROL // Multiple SID support diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 2f2a2206..07a981c0 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -49,6 +49,8 @@ #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO +// #define CONFIG_TAPE_NO_KEY_SENSE +// #define CONFIG_TAPE_NO_MOTOR_CONTROL // Multiple SID support diff --git a/c64/kernal/iec/iec_wait1ms.s b/c64/kernal/iec/iec_wait1ms.s index 9e550f35..4e81fb14 100644 --- a/c64/kernal/iec/iec_wait1ms.s +++ b/c64/kernal/iec/iec_wait1ms.s @@ -16,7 +16,7 @@ iec_wait1ms: ldx #18 // we probably won't start with the beginning of raster #endif // CONFIG_IEC -#if CONFIG_IEC || CONFIG_TAPE_TURBO || CONFIG_TAPE_NORMAL +#if CONFIG_IEC || (!CONFIG_TAPE_NO_MOTOR_CONTROL && (CONFIG_TAPE_TURBO || CONFIG_TAPE_NORMAL)) wait_x_bars: // additional entry point for tape support // has to preserve .Y and put .X to 0 @@ -34,4 +34,4 @@ iec_wait_rts: // dummy RTS, for very short waits rts -#endif // CONFIG_IEC || CONFIG_TAPE_TURBO || CONFIG_TAPE_NORMAL +#endif diff --git a/c64/kernal/tape/tape_common.s b/c64/kernal/tape/tape_common.s index a74db3af..ee56f8ac 100644 --- a/c64/kernal/tape/tape_common.s +++ b/c64/kernal/tape/tape_common.s @@ -28,12 +28,16 @@ tape_ask_play: sei // timing is critical for tape loading +#if !CONFIG_TAPE_NO_KEY_SENSE + // First check whether the button is already pressed lda CPU_R6510 and #$10 beq tape_wait_play_done +#endif + // Display message ldx #__MSG_KERNAL_PRESS_PLAY @@ -41,6 +45,8 @@ tape_ask_play: // FALLTROUGH +#if !CONFIG_TAPE_NO_KEY_SENSE + tape_wait_play_loop: jsr udtim_keyboard @@ -51,6 +57,26 @@ tape_wait_play_loop: and #$10 // check for pressed button bne tape_wait_play_loop + // FALLTROUGH + +#else + + // We have no key sense - so just turn the motor on and wait for the first pulse + + jsr tape_motor_on + + lda #$10 +!: + bit CIA1_ICR // $DC0D + bne !- +!: + bit CIA1_ICR // $DC0D + beq !- + +#endif + + // FALLTROUGH + tape_wait_play_done: // Prepare for reading @@ -68,8 +94,12 @@ tape_wait_play_done: tape_handle_header: +#if !CONFIG_TAPE_NO_MOTOR_CONTROL + jsr tape_screen_on_motor_off +#endif + // Print FOUND + file name ldx #__MSG_KERNAL_FOUND @@ -83,11 +113,15 @@ tape_handle_header: cpy #$15 bne !- +#if !CONFIG_TAPE_NO_MOTOR_CONTROL + // Header, wait for user decision jsr tape_header_get_decision bcs tape_break_error +#endif + // Check if file name matches jsr tape_match_filename @@ -151,14 +185,20 @@ tape_handle_header: jsr lvs_display_loading_verifying + // FALLTROUGH + +#if !CONFIG_TAPE_NO_MOTOR_CONTROL + tape_handle_header_displayed: // Load the file jsr tape_screen_off_motor_on - + // FALLTROUGH +#endif + tape_return_ok: clc @@ -211,6 +251,8 @@ tape_match_loop: rts +#if !CONFIG_TAPE_NO_MOTOR_CONTROL + // // Get user decision whether to load the file or not // @@ -223,7 +265,7 @@ tape_header_get_decision: lda STKEY bpl tape_header_wait_stop // STOP pressed and #$10 - beq tape_header_wait_space // space pressed + beq tape_header_wait_space // SPACE pressed ldx #$80 jsr wait_x_bars // sets .X to 0 @@ -245,6 +287,8 @@ tape_header_wait_stop: sec rts +#endif + // // Report that file loading succeeded (or not)