1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

The Disk II card now commutes Disk II sleep activity to select constraints.

This commit is contained in:
Thomas Harte 2018-05-22 19:51:39 -04:00
parent 80d34f5511
commit 015f692bd3
2 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,7 @@ DiskIICard::DiskIICard(const ROMMachine::ROMFetcher &rom_fetcher, bool is_16_sec
boot_ = std::move(*roms[0]);
diskii_.set_state_machine(*roms[1]);
set_select_constraints(None);
diskii_.set_sleep_observer(this);
}
void DiskIICard::perform_bus_operation(Select select, bool is_read, uint16_t address, uint8_t *value) {
@ -40,6 +41,7 @@ void DiskIICard::perform_bus_operation(Select select, bool is_read, uint16_t add
}
void DiskIICard::run_for(Cycles cycles, int stretches) {
if(diskii_is_sleeping_) return;
diskii_.run_for(Cycles(cycles.as_int() * 2));
}
@ -50,3 +52,8 @@ void DiskIICard::set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int
void DiskIICard::set_activity_observer(Activity::Observer *observer) {
diskii_.set_activity_observer(observer);
}
void DiskIICard::set_component_is_sleeping(Sleeper *component, bool is_sleeping) {
diskii_is_sleeping_ = is_sleeping;
set_select_constraints(is_sleeping ? (IO | Device) : 0);
}

View File

@ -22,7 +22,7 @@
namespace AppleII {
class DiskIICard: public Card {
class DiskIICard: public Card, public Sleeper::SleepObserver {
public:
DiskIICard(const ROMMachine::ROMFetcher &rom_fetcher, bool is_16_sector);
@ -34,8 +34,10 @@ class DiskIICard: public Card {
void set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int drive);
private:
void set_component_is_sleeping(Sleeper *component, bool is_sleeping) override;
std::vector<uint8_t> boot_;
Apple::DiskII diskii_;
bool diskii_is_sleeping_ = false;
};
}