commit 2f27e29758da1f1ec965588c0712125051a6f71a Merge: ba722b1796b62fAuthor: 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: e4b0ec9e410bc0Author: 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
61 lines
1.4 KiB
ArmAsm
61 lines
1.4 KiB
ArmAsm
// #LAYOUT# STD * #TAKE
|
|
// #LAYOUT# M65 KERNAL_1 #TAKE
|
|
// #LAYOUT# * * #IGNORE
|
|
|
|
//
|
|
// Tape (turbo) helper routine - byte reading
|
|
//
|
|
// Returns byte in .A
|
|
//
|
|
|
|
// 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_get_byte:
|
|
|
|
phx_trash_a
|
|
lda #$01
|
|
sta INBIT // init the to-be-read byte with 1 (canary bit to mark loop end)
|
|
!:
|
|
jsr tape_turbo_get_bit
|
|
rol INBIT
|
|
bcc !- // is the initial 1 shifted into carry already?
|
|
plx_trash_a
|
|
|
|
// Compensate for tape speed variations
|
|
|
|
lda __turbo_half_S // half of the last value for bit '0'
|
|
clc
|
|
adc __turbo_half_L // half of the last value for bit '1'
|
|
|
|
sec
|
|
sbc __pulse_threshold // now we have a diff between current threshold and calculated one
|
|
beq tape_turbo_get_byte_done // branch if threshold correction not needed
|
|
|
|
bpl !+
|
|
|
|
lda __pulse_threshold
|
|
cmp #($BF - 10)
|
|
beq tape_turbo_get_byte_done // do not decrease threshold too far no matter what
|
|
|
|
dec __pulse_threshold
|
|
bne tape_turbo_get_byte_done // branch always
|
|
!:
|
|
lda __pulse_threshold
|
|
cmp #($BF + 10)
|
|
beq tape_turbo_get_byte_done // do not increase threshold too far no matter what
|
|
|
|
inc __pulse_threshold
|
|
|
|
tape_turbo_get_byte_done:
|
|
|
|
lda INBIT
|
|
rts
|
|
|
|
|
|
#endif // CONFIG_TAPE_TURBO
|