Files
open-roms/c64/kernal/tape/tape_turbo_sync.s
T
FeralChild64 d489e7bf41 tape routines can now be placed in Mega65 extra ROM space
commit 2f27e29758da1f1ec965588c0712125051a6f71a
Merge: ba722b1 796b62f
Author: FeralChild64 <you@example.com>
Date:   Tue Jan 28 17:34:53 2020 +0100

    Merge branch 'master' into tape_redirect

commit ba722b17e627af7dd067932688de0a3d86423e37
Author: FeralChild64 <you@example.com>
Date:   Tue Jan 28 17:28:19 2020 +0100

    finished Mega65 variant of tape routines

commit 47de685f2e08576504c5e00a5b7cb78498d22e72
Author: FeralChild64 <you@example.com>
Date:   Mon Jan 27 23:06:45 2020 +0100

    compilation fix

commit c3641acec049a7a6b53c35795b1f9e2df212cec2
Author: FeralChild64 <you@example.com>
Date:   Mon Jan 27 22:53:30 2020 +0100

    dependencies fix

commit dfad7a30bde043fa077005624dde1de4b72573b6
Merge: e4b0ec9 e410bc0
Author: FeralChild64 <you@example.com>
Date:   Mon Jan 27 21:25:49 2020 +0100

    Merge branch 'master' into tape_redirect

commit e4b0ec9c85861bde2ce52e0828d3bf895a681e17
Author: FeralChild64 <you@example.com>
Date:   Sat Jan 25 22:25:20 2020 +0100

    initial attempt to move tape code to Mega65 extra ROM
2020-01-28 17:35:42 +01:00

78 lines
1.3 KiB
ArmAsm

// #LAYOUT# STD * #TAKE
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// Tape (turbo) helper routine - synchronization handling
//
// Based on routine by enthusi/Onslaught, found here:
// - https://codebase64.pokefinder.org/doku.php?id=base:turbotape_loader_source
#if CONFIG_TAPE_TURBO
tape_turbo_sync_header:
// Initial pulse threshold
lda #$BF // measured 128 bits '0' and 128 bits '1' under VICE, calculated average
sta __pulse_threshold
// Synchronize with start of sync sequence
jsr tape_turbo_sync_first
#if CONFIG_TAPE_AUTODETECT
bcs tape_turbo_sync_done
#endif
// Perform synchronization, double loop, total $C0 * $04 iterations
ldx #$C0
!:
ldy #$04
!:
stx XSAV
jsr tape_turbo_get_byte
cmp #$02
bne tape_turbo_sync_header // branch if failure
dey
bne !-
ldx XSAV
dex
bne !--
// FALLTROUGH
tape_turbo_sync_payload:
jsr tape_turbo_sync_first
#if CONFIG_TAPE_AUTODETECT
bcs tape_turbo_sync_done // this shopuld not happen
#endif
!:
ldx #$09 // 9, 8, ...
!:
jsr tape_turbo_get_byte
cmp #$02
beq !-
ldy #$00
!:
cpx INBIT
bne tape_turbo_sync_payload
jsr tape_turbo_get_byte
dex
bne !-
#if CONFIG_TAPE_AUTODETECT
clc
#endif
// FALLTROUGH
tape_turbo_sync_done:
rts
#endif // CONFIG_TAPE_TURBO