From 44e5a03cf2449477288eca80b86161a8c4fcb9a2 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 19 Jul 2017 19:21:27 -0400 Subject: [PATCH] Removed just-don't-power-the-tape approach to pausing and playing, in favour of being fully communicative. --- Machines/ZX8081/ZX8081.cpp | 9 ++++----- Machines/ZX8081/ZX8081.hpp | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 6bf9cab22..83f6b8e54 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -24,11 +24,8 @@ Machine::Machine() : tape_player_(ZX8081ClockRate), use_fast_tape_hack_(false), tape_advance_delay_(0), - tape_is_automatically_playing_(false), - tape_is_playing_(false), has_latched_video_byte_(false) { set_clock_rate(ZX8081ClockRate); - tape_player_.set_motor_control(true); clear_all_keys(); } @@ -58,7 +55,7 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) { if(is_zx81_) horizontal_counter_ %= 207; if(!tape_advance_delay_) { - if(tape_is_automatically_playing_ || tape_is_playing_) tape_player_.run_for_cycles(cycle.length); + tape_player_.run_for_cycles(cycle.length); } else { tape_advance_delay_ = std::max(tape_advance_delay_ - cycle.length, 0); } @@ -152,7 +149,9 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) { } // Check for automatic tape control. - tape_is_automatically_playing_ = use_automatic_tape_motor_control_ && (address >= automatic_tape_motor_start_address_) && (address < automatic_tape_motor_end_address_); + if(use_automatic_tape_motor_control_) { + tape_player_.set_motor_control((address >= automatic_tape_motor_start_address_) && (address < automatic_tape_motor_end_address_)); + } is_opcode_read = true; case CPU::Z80::PartialMachineCycle::Read: diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index 23d773dbf..4b6bf9dda 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -69,9 +69,11 @@ class Machine: inline void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } inline void set_use_automatic_tape_motor_control(bool enabled) { use_automatic_tape_motor_control_ = enabled; - if(!enabled) tape_is_automatically_playing_ = false; + if(!enabled) { + tape_player_.set_motor_control(false); + } } - inline void set_tape_is_playing(bool is_playing) { tape_is_playing_ = is_playing; } + inline void set_tape_is_playing(bool is_playing) { tape_player_.set_motor_control(is_playing); } // for Utility::TypeRecipient::Delegate uint16_t *sequence_for_character(Utility::Typer *typer, char character); @@ -113,7 +115,6 @@ class Machine: bool use_fast_tape_hack_; bool use_automatic_tape_motor_control_; - bool tape_is_playing_, tape_is_automatically_playing_; int tape_advance_delay_; };