diff --git a/c64/kernal/tape/tape_turbo_sync.s b/c64/kernal/tape/tape_turbo_sync.s index d442789f..2e2fc2ae 100644 --- a/c64/kernal/tape/tape_turbo_sync.s +++ b/c64/kernal/tape/tape_turbo_sync.s @@ -11,17 +11,9 @@ #if CONFIG_TAPE_TURBO -tape_turbo_sync_common: - - jsr tape_turbo_get_bit - rol INBIT - lda INBIT - cmp #$02 - bne tape_turbo_sync_common - rts - tape_turbo_sync_header: + #if CONFIG_TAPE_TURBO_AUTOCALIBRATE // Initial pulse threshold @@ -38,13 +30,19 @@ tape_turbo_sync_header: #endif // CONFIG_TAPE_TURBO_AUTOCALIBRATE + // Synchronize with start of sync sequence + jsr tape_turbo_sync_first + // Perform synchronization ldx #$C0 !: phx_trash_a ldy #$04 !: - jsr tape_turbo_sync_common + jsr tape_turbo_get_byte + cmp #$02 + bne tape_turbo_sync_header // branch if failure + dey bne !- plx_trash_a @@ -96,7 +94,7 @@ tape_turbo_sync_calibrate_loop: tape_turbo_sync_payload: - jsr tape_turbo_sync_common + jsr tape_turbo_sync_first !: ldx #$09 // 9, 8, ... !: diff --git a/c64/kernal/tape/tape_turbo_sync_first.s b/c64/kernal/tape/tape_turbo_sync_first.s new file mode 100644 index 00000000..2d7bc533 --- /dev/null +++ b/c64/kernal/tape/tape_turbo_sync_first.s @@ -0,0 +1,24 @@ +#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0) + +// +// Tape (turbo) helper routine - syynchronize to first byte with value $02 +// + +#if CONFIG_TAPE_TURBO + + +tape_turbo_sync_first: + + jsr tape_turbo_get_bit + rol INBIT + lda INBIT + cmp #$02 + bne tape_turbo_sync_first + + rts + + +#endif + + +#endif // ROM layout