1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-27 22:30:49 +00:00

Experiment with reads/writes earlier in the transaction.

This commit is contained in:
Thomas Harte 2024-10-15 12:10:36 -04:00
parent 947e890c59
commit 23f1308231

View File

@ -847,6 +847,9 @@ class ConcreteMachine:
clock_offset_ = (clock_offset_ + cycle.length) & HalfCycles(7);
z80_.set_wait_line(clock_offset_ >= HalfCycles(2));
// Float this out as a lambda to allow easy repositioning relative to the CPU activity;
// for now this is largely experimental.
const auto update_subsystems = [&] {
// Update the CRTC once every eight half cycles; aiming for half-cycle 4 as
// per the initial seed to the crtc_counter_, but any time in the final four
// will do as it's safe to conclude that nobody else has touched video RAM
@ -873,10 +876,10 @@ class ConcreteMachine:
// Update typing activity.
if(typer_) typer_->run_for(cycle.length);
};
// Stop now if no action is strictly required.
if(!cycle.is_terminal()) return HalfCycles(0);
// Continue only if action strictly required.
if(cycle.is_terminal()) {
uint16_t address = cycle.address ? *cycle.address : 0x0000;
switch(cycle.operation) {
case CPU::Z80::PartialMachineCycle::ReadOpcode:
@ -1061,6 +1064,9 @@ class ConcreteMachine:
default: break;
}
}
update_subsystems();
// Check whether the interrupt signal has changed the other way.
if(interrupt_timer_.request_has_changed()) z80_.set_interrupt_line(interrupt_timer_.get_request());