mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-08 15:29:09 +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 {
|
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
|
// 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
|
// of responding to the line parameter table interrupt flag as soon as it's
|
||||||
// loaded.
|
// loaded.
|
||||||
|
|
||||||
// i.e. 0 -> 0, 1 -> 15 ... 15 -> 1.
|
// Assumed below: the Z80 can start its final cycle anywhere in the first three
|
||||||
return Cycles(
|
// of the permitted six.
|
||||||
15 ^ ((horizontal_counter_ + 15 + after_period.as<int>()) & 15)
|
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) {
|
void Nick::run_for(Cycles duration) {
|
||||||
|
Loading…
Reference in New Issue
Block a user