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
+47 -12

No files matched your search

+46 -6
View File
@@ -19,30 +19,34 @@ tape_normal_calibrate_during_pilot: // reecalibration during the pilot
// We do not have any recent medium pulse measurement, // We do not have any recent medium pulse measurement,
// probably the only solution is to estimate it // probably the only solution is to estimate it
lda $FF lda #$FF
sec sec
sbc __normal_time_S sbc __normal_time_S
// We now have a difference from the starting point ($FF) // We now have a difference from the starting point ($FF)
clc clc
rol ror
sta __normal_time_M // this is temporary only! sta __normal_time_M // this is temporary only!
// We now have half the difference, substract it from // We now have half the difference, substract it from
// short pulse measurement result // short pulse measurement result
lda __normal_time_S lda __normal_time_S
clc sec
sbc __normal_time_M sbc __normal_time_M
// 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 // Add a small correction to gain $7D if starting from $A5. Dirty, ugly,
// and imprecise hack - but in real life should be good enough
sta __normal_time_M clc
adc #$05
sta __normal_time_M // estimated medium pulse length
jmp tape_normal_calibrate_common 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 sta __normal_time_S
@@ -68,14 +72,50 @@ tape_normal_calibrate_common:
adc __normal_time_M adc __normal_time_M
cmp __pulse_threshold 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
// XXX implement recalibration 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: 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 tape_normal_get_pilot_header: // entry point, reset calibration, require 128x $40 pulses
// Reading the pilot header is the first action performed, // Reading the pilot header is the first action performed,
// thus start by setting default timings, as measured during // thus start by setting default thresholds
// VICE test
lda #$7D
sta __normal_time_M // __normal_time_S will be set within the pilot
lda #$91 lda #$91
sta __pulse_threshold sta __pulse_threshold
lda #$67 lda #$67
sta __pulse_threshold_ML sta __pulse_threshold_ML
lda #$80 lda #$80
skip_2_bytes_trash_nvz skip_2_bytes_trash_nvz
// FALLTROUGH // 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 tape_normal_get_pilot_data: // entry point, require 4x $40 pulses
lda #$04 lda #$04
skip_2_bytes_trash_nvz skip_2_bytes_trash_nvz
// FALLTROUGH // FALLTROUGH