tape speed adjustments for normal load works now

This commit is contained in:
FeralChild64 committed 2020-01-20 21:13:22 +01:00
1 parent 37c86a33d1
commit e9b9767a71
2 files changed
+53 -18

No files matched your search

+52 -12
View File
@@ -12,38 +12,42 @@
#if CONFIG_TAPE_NORMAL
tape_normal_calibrate_during_pilot: // reecalibration during the pilot
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
lda #$FF
sec
sbc __normal_time_S
// We now have a difference from the starting point ($FF)
clc
rol
sta __normal_time_M // this is temporary only!
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
clc
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
// XXX add some constant to get a proper __normal_time_M ($7D if starting from $A5), afterwards remove __normal_time_M initialization from tape_normal_get_pilot_header
sta __normal_time_M
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
tape_normal_calibrate_after_S: // recalibration after short pulse
sta __normal_time_S
rts
@@ -51,7 +55,7 @@ tape_normal_calibrate_after_S: // recalibration after short pulse
// FALLTROUGH
tape_normal_calibrate_after_M: // recalibration after medium pulse
tape_normal_calibrate_after_M: // recalibration after medium pulse
sta __normal_time_M
@@ -68,14 +72,50 @@ tape_normal_calibrate_common:
adc __normal_time_M
cmp __pulse_threshold
beq tape_normal_calibrate_done // branch if no recalibration needed
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:
// XXX implement recalibration
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:
+1 -6
View File
@@ -21,18 +21,14 @@
tape_normal_get_pilot_header: // entry point, reset calibration, require 128x $40 pulses
// Reading the pilot header is the first action performed,
// thus start by setting default timings, as measured during
// VICE test
// thus start by setting default thresholds
lda #$7D
sta __normal_time_M // __normal_time_S will be set within the pilot
lda #$91
sta __pulse_threshold
lda #$67
sta __pulse_threshold_ML
lda #$80
skip_2_bytes_trash_nvz
// FALLTROUGH
@@ -40,7 +36,6 @@ tape_normal_get_pilot_header: // entry point, reset calibration, requir
tape_normal_get_pilot_data: // entry point, require 4x $40 pulses
lda #$04
skip_2_bytes_trash_nvz
// FALLTROUGH