1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-08 15:29:09 +00:00

The CPC now responds to tape-originating sleeper observations.

This commit is contained in:
Thomas Harte 2017-08-20 12:21:02 -04:00
parent 8fdc5012e4
commit 8f5ae4a326

View File

@ -682,9 +682,12 @@ class ConcreteMachine:
// ensure memory starts in a random state // ensure memory starts in a random state
Memory::Fuzz(ram_, sizeof(ram_)); Memory::Fuzz(ram_, sizeof(ram_));
// register this class as the sleep observer for the FDC // register this class as the sleep observer for the FDC and tape
fdc_.set_sleep_observer(this); fdc_.set_sleep_observer(this);
fdc_is_sleeping_ = fdc_.is_sleeping(); fdc_is_sleeping_ = fdc_.is_sleeping();
tape_player_.set_sleep_observer(this);
tape_player_is_sleeping_ = tape_player_.is_sleeping();
} }
/// The entry point for performing a partial Z80 machine cycle. /// The entry point for performing a partial Z80 machine cycle.
@ -704,7 +707,7 @@ class ConcreteMachine:
// TODO (in the player, not here): adapt it to accept an input clock rate and // TODO (in the player, not here): adapt it to accept an input clock rate and
// run_for as HalfCycles // run_for as HalfCycles
tape_player_.run_for(cycle.length.as_int()); if(!tape_player_is_sleeping_) tape_player_.run_for(cycle.length.as_int());
// Pump the AY // Pump the AY
ay_.run_for(cycle.length); ay_.run_for(cycle.length);
@ -914,8 +917,8 @@ class ConcreteMachine:
} }
void set_component_is_sleeping(void *component, bool is_sleeping) { void set_component_is_sleeping(void *component, bool is_sleeping) {
// The FDC is the only thing this registers with as a sleep observer. if(component == &fdc_) fdc_is_sleeping_ = is_sleeping;
fdc_is_sleeping_ = is_sleeping; else tape_player_is_sleeping_ = is_sleeping;
} }
#pragma mark - Keyboard #pragma mark - Keyboard
@ -1012,6 +1015,7 @@ class ConcreteMachine:
std::vector<uint8_t> roms_[7]; std::vector<uint8_t> roms_[7];
int rom_model_; int rom_model_;
bool has_fdc_, fdc_is_sleeping_; bool has_fdc_, fdc_is_sleeping_;
bool tape_player_is_sleeping_;
bool has_128k_; bool has_128k_;
bool upper_rom_is_paged_; bool upper_rom_is_paged_;
int upper_rom_; int upper_rom_;