mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Attempts to reduce FDC costs.
This commit is contained in:
parent
db8d8d8404
commit
f3fe711542
@ -746,7 +746,7 @@ class ConcreteMachine:
|
|||||||
ay_.run_for(cycle.length);
|
ay_.run_for(cycle.length);
|
||||||
|
|
||||||
// Clock the FDC, if connected, using a lazy scale by two
|
// Clock the FDC, if connected, using a lazy scale by two
|
||||||
if(has_fdc_ && !fdc_is_sleeping_) fdc_.run_for(Cycles(cycle.length.as_int()));
|
time_since_fdc_update_ += cycle.length;
|
||||||
|
|
||||||
// Update typing activity
|
// Update typing activity
|
||||||
if(typer_) typer_->run_for(cycle.length);
|
if(typer_) typer_->run_for(cycle.length);
|
||||||
@ -793,11 +793,13 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
// Check for an FDC access
|
// Check for an FDC access
|
||||||
if(has_fdc_ && (address & 0x580) == 0x100) {
|
if(has_fdc_ && (address & 0x580) == 0x100) {
|
||||||
|
flush_fdc();
|
||||||
fdc_.set_register(address & 1, *cycle.value);
|
fdc_.set_register(address & 1, *cycle.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a disk motor access
|
// Check for a disk motor access
|
||||||
if(has_fdc_ && !(address & 0x580)) {
|
if(has_fdc_ && !(address & 0x580)) {
|
||||||
|
flush_fdc();
|
||||||
fdc_.set_motor_on(!!(*cycle.value));
|
fdc_.set_motor_on(!!(*cycle.value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -812,6 +814,7 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
// Check for an FDC access
|
// Check for an FDC access
|
||||||
if(has_fdc_ && (address & 0x580) == 0x100) {
|
if(has_fdc_ && (address & 0x580) == 0x100) {
|
||||||
|
flush_fdc();
|
||||||
*cycle.value &= fdc_.get_register(address & 1);
|
*cycle.value &= fdc_.get_register(address & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,6 +858,7 @@ class ConcreteMachine:
|
|||||||
// Just flush the AY.
|
// Just flush the AY.
|
||||||
ay_.update();
|
ay_.update();
|
||||||
ay_.flush();
|
ay_.flush();
|
||||||
|
flush_fdc();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A CRTMachine function; indicates that outputs should be created now.
|
/// A CRTMachine function; indicates that outputs should be created now.
|
||||||
@ -967,6 +971,7 @@ class ConcreteMachine:
|
|||||||
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override final {
|
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override final {
|
||||||
fdc_is_sleeping_ = fdc_.preferred_clocking() == ClockingHint::Preference::None;
|
fdc_is_sleeping_ = fdc_.preferred_clocking() == ClockingHint::Preference::None;
|
||||||
tape_player_is_sleeping_ = tape_player_.preferred_clocking() == ClockingHint::Preference::None;
|
tape_player_is_sleeping_ = tape_player_.preferred_clocking() == ClockingHint::Preference::None;
|
||||||
|
printf("FDC: %s, tape %s\n", fdc_is_sleeping_ ? "sleeping" : "regular", tape_player_is_sleeping_ ? "sleeping" : "regular");
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Keyboard
|
// MARK: - Keyboard
|
||||||
@ -1060,6 +1065,14 @@ class ConcreteMachine:
|
|||||||
Intel::i8255::i8255<i8255PortHandler> i8255_;
|
Intel::i8255::i8255<i8255PortHandler> i8255_;
|
||||||
|
|
||||||
FDC fdc_;
|
FDC fdc_;
|
||||||
|
HalfCycles time_since_fdc_update_;
|
||||||
|
void flush_fdc() {
|
||||||
|
// Clock the FDC, if connected, using a lazy scale by two
|
||||||
|
if(has_fdc_ && !fdc_is_sleeping_) {
|
||||||
|
fdc_.run_for(Cycles(time_since_fdc_update_.as_int()));
|
||||||
|
}
|
||||||
|
time_since_fdc_update_ = HalfCycles(0);
|
||||||
|
}
|
||||||
|
|
||||||
InterruptTimer interrupt_timer_;
|
InterruptTimer interrupt_timer_;
|
||||||
Storage::Tape::BinaryTapePlayer tape_player_;
|
Storage::Tape::BinaryTapePlayer tape_player_;
|
||||||
|
Loading…
Reference in New Issue
Block a user