1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Determined what appears to be an appropriate workaround for the ZX81 TZX that I've managed to obtain.

This commit is contained in:
Thomas Harte 2017-07-19 21:28:33 -04:00
parent 44e5a03cf2
commit 70af075012

View File

@ -31,10 +31,19 @@ TZX::TZX(const char *file_name) :
// Reject if an incompatible version
if(major_version != 1 || minor_version > 20) throw ErrorNotTZX;
virtual_reset();
}
void TZX::virtual_reset() {
clear();
// This is a workaround for arguably dodgy ZX80/ZX81 TZXs; they launch straight
// into data but both machines require a gap before data begins. So impose
// an initial gap, in the form of a very long wave.
emplace_back(Tape::Pulse::Low, Storage::Time(1, 4));
emplace_back(Tape::Pulse::High, Storage::Time(1, 4));
set_is_at_end(false);
next_is_high_ = false;
fseek(file_, 0x0a, SEEK_SET);
@ -152,7 +161,7 @@ void TZX::get_generalised_segment(uint32_t output_symbols, uint8_t max_pulses_pe
}
void TZX::post_pulse(unsigned int length) {
emplace_back(next_is_high_ ? Tape::Pulse::High : Tape::Pulse::Low, Storage::Time(length, StandardTZXClock));
emplace_back(next_is_high_ ? Tape::Pulse::Low : Tape::Pulse::High, Storage::Time(length, StandardTZXClock));
next_is_high_ ^= true;
}