1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-10 12:29:01 +00:00

Removed just-don't-power-the-tape approach to pausing and playing, in favour of being fully communicative.

This commit is contained in:
Thomas Harte 2017-07-19 19:21:27 -04:00
parent c8cee88e33
commit 44e5a03cf2
2 changed files with 8 additions and 8 deletions

View File

@ -24,11 +24,8 @@ Machine::Machine() :
tape_player_(ZX8081ClockRate), tape_player_(ZX8081ClockRate),
use_fast_tape_hack_(false), use_fast_tape_hack_(false),
tape_advance_delay_(0), tape_advance_delay_(0),
tape_is_automatically_playing_(false),
tape_is_playing_(false),
has_latched_video_byte_(false) { has_latched_video_byte_(false) {
set_clock_rate(ZX8081ClockRate); set_clock_rate(ZX8081ClockRate);
tape_player_.set_motor_control(true);
clear_all_keys(); clear_all_keys();
} }
@ -58,7 +55,7 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
if(is_zx81_) horizontal_counter_ %= 207; if(is_zx81_) horizontal_counter_ %= 207;
if(!tape_advance_delay_) { 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 { } else {
tape_advance_delay_ = std::max(tape_advance_delay_ - cycle.length, 0); 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. // 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; is_opcode_read = true;
case CPU::Z80::PartialMachineCycle::Read: case CPU::Z80::PartialMachineCycle::Read:

View File

@ -69,9 +69,11 @@ class Machine:
inline void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; } inline void set_use_fast_tape_hack(bool activate) { use_fast_tape_hack_ = activate; }
inline void set_use_automatic_tape_motor_control(bool enabled) { inline void set_use_automatic_tape_motor_control(bool enabled) {
use_automatic_tape_motor_control_ = 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 // for Utility::TypeRecipient::Delegate
uint16_t *sequence_for_character(Utility::Typer *typer, char character); uint16_t *sequence_for_character(Utility::Typer *typer, char character);
@ -113,7 +115,6 @@ class Machine:
bool use_fast_tape_hack_; bool use_fast_tape_hack_;
bool use_automatic_tape_motor_control_; bool use_automatic_tape_motor_control_;
bool tape_is_playing_, tape_is_automatically_playing_;
int tape_advance_delay_; int tape_advance_delay_;
}; };