mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Allow that final Z80 cycle to start anywhere in the first three of Nick's window of six.
This commit is contained in:
parent
850aa2b23a
commit
4fffb3cf19
@ -96,15 +96,19 @@ uint8_t Nick::read([[maybe_unused]] uint16_t address) {
|
||||
}
|
||||
|
||||
Cycles Nick::get_time_until_z80_slot(Cycles after_period) const {
|
||||
// Place Z80 accesses as the first six cycles in each sixteen-cycle window.
|
||||
// Place Z80 accesses in the first six cycles in each sixteen-cycle window.
|
||||
// That models video accesses as being the final ten. Which has the net effect
|
||||
// of responding to the line parameter table interrupt flag as soon as it's
|
||||
// loaded.
|
||||
|
||||
// i.e. 0 -> 0, 1 -> 15 ... 15 -> 1.
|
||||
return Cycles(
|
||||
15 ^ ((horizontal_counter_ + 15 + after_period.as<int>()) & 15)
|
||||
);
|
||||
// Assumed below: the Z80 can start its final cycle anywhere in the first three
|
||||
// of the permitted six.
|
||||
const int offset = (horizontal_counter_ + after_period.as<int>()) & 15;
|
||||
if(offset < 3) {
|
||||
return 0;
|
||||
} else {
|
||||
return 16 - offset;
|
||||
}
|
||||
}
|
||||
|
||||
void Nick::run_for(Cycles duration) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user