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
127 lines
2.3 KiB
ArmAsm
127 lines
2.3 KiB
ArmAsm
// #LAYOUT# STD * #TAKE
|
|
// #LAYOUT# M65 KERNAL_1 #TAKE
|
|
// #LAYOUT# * * #IGNORE
|
|
|
|
//
|
|
// Tape (normal) helper routine - reading speed calibration
|
|
//
|
|
// Needs pulse length in .A
|
|
//
|
|
|
|
|
|
#if CONFIG_TAPE_NORMAL
|
|
|
|
|
|
tape_normal_calibrate_during_pilot: // reecalibration during the pilot
|
|
|
|
sta __normal_time_S
|
|
|
|
// We do not have any recent medium pulse measurement,
|
|
// probably the only solution is to estimate it
|
|
|
|
lda #$FF
|
|
sec
|
|
sbc __normal_time_S
|
|
|
|
// We now have a difference from the starting point ($FF)
|
|
|
|
clc
|
|
ror
|
|
sta __normal_time_M // this is temporary only!
|
|
|
|
// We now have half the difference, substract it from
|
|
// short pulse measurement result
|
|
|
|
lda __normal_time_S
|
|
sec
|
|
sbc __normal_time_M
|
|
|
|
// Add a small correction to gain $7D if starting from $A5. Dirty, ugly,
|
|
// and imprecise hack - but in real life should be good enough
|
|
|
|
clc
|
|
adc #$05
|
|
sta __normal_time_M // estimated medium pulse length
|
|
|
|
jmp tape_normal_calibrate_common
|
|
|
|
|
|
|
|
tape_normal_calibrate_after_S: // recalibration after short pulse
|
|
|
|
sta __normal_time_S
|
|
rts
|
|
skip_2_bytes_trash_nvz
|
|
|
|
// FALLTROUGH
|
|
|
|
tape_normal_calibrate_after_M: // recalibration after medium pulse
|
|
|
|
sta __normal_time_M
|
|
|
|
// FALLTROUGH
|
|
|
|
tape_normal_calibrate_common:
|
|
|
|
// Now compare results with current threshold
|
|
|
|
lda __normal_time_S
|
|
sec
|
|
sbc __pulse_threshold
|
|
clc
|
|
adc __normal_time_M
|
|
|
|
cmp __pulse_threshold
|
|
|
|
beq tape_normal_calibrate_done // branch if no recalibration needed
|
|
|
|
// Correct the thresholds (default is $91 for the S/M one)
|
|
|
|
bcs tape_normal_calibrate_threshold_inc // branch if .A >= memory
|
|
|
|
// FALLTROUGH
|
|
|
|
|
|
tape_normal_calibrate_threshold_dec:
|
|
|
|
lda __pulse_threshold
|
|
cmp #($91-10)
|
|
bcc tape_normal_calibrate_done // do not decrement thresholds too far
|
|
|
|
sec
|
|
sbc #$02
|
|
sta __pulse_threshold
|
|
|
|
lda __pulse_threshold_ML
|
|
sec
|
|
sbc #$03
|
|
sta __pulse_threshold_ML
|
|
|
|
bne tape_normal_calibrate_done // branch always
|
|
|
|
|
|
tape_normal_calibrate_threshold_inc:
|
|
|
|
lda __pulse_threshold
|
|
cmp #($91+11)
|
|
bcs tape_normal_calibrate_done // do not increment thresholds too far
|
|
|
|
clc
|
|
adc #$02
|
|
sta __pulse_threshold
|
|
|
|
lda __pulse_threshold_ML
|
|
clc
|
|
adc #$03
|
|
sta __pulse_threshold_ML
|
|
|
|
// FALLTROUGH
|
|
|
|
|
|
tape_normal_calibrate_done:
|
|
|
|
rts
|
|
|
|
|
|
#endif
|