diff --git a/CONFIG.md b/CONFIG.md index 35ae74b1..f548ee4f 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -167,7 +167,7 @@ Needs about 100 more bytes in KERNAL segment. ### `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 impulses start arriving from the tape. +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 - this option changes the ROM behaviour, so that it can detect Play pressed when impulses start arriving from the tape. ### `CONFIG_TAPE_NO_MOTOR_CONTROL` diff --git a/c64/kernal/tape/tape_common.s b/c64/kernal/tape/tape_common.s index 851f0eeb..fa813aef 100644 --- a/c64/kernal/tape/tape_common.s +++ b/c64/kernal/tape/tape_common.s @@ -61,20 +61,49 @@ tape_wait_play_loop: #else + // The ROM is configured for tape adapter without the key sense - but it is still + // possible, that regular Datasette or Tapuino is connected + + lda CPU_R6510 + and #$10 + beq tape_wait_first_pulse // branch if button reported pressed, most likely really no key sense + + // We have key sense - perform regular waiting +!: + jsr STOP + bcs tape_break_error + + lda CPU_R6510 + and #$10 + beq !- + +tape_wait_first_pulse: + // We have no key sense - so just turn the motor on and wait for the first pulse jsr tape_motor_on - lda #$10 !: + jsr STOP + bcs tape_break_error + + lda #$10 bit CIA1_ICR // $DC0D bne !- !: + jsr STOP + bcs tape_break_error + + lda #$10 bit CIA1_ICR // $DC0D beq !- #endif + // FALLTROUGH + +tape_wait_play_done: + #if CONFIG_MB_MEGA_65 // Display confirmation @@ -84,10 +113,6 @@ tape_wait_play_loop: #endif - // FALLTROUGH - -tape_wait_play_done: - // Prepare for reading lda #$01