mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Merge pull request #445 from TomHarte/ColecoVisionDelay
Imposes a three-cycle penalty for SN76489 access.
This commit is contained in:
commit
44ad0970be
@ -198,8 +198,19 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
// MARK: Z80::BusHandler
|
// MARK: Z80::BusHandler
|
||||||
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||||
time_since_vdp_update_ += cycle.length;
|
// The SN76489 will use its ready line to trigger the Z80's wait for three
|
||||||
time_since_sn76489_update_ += cycle.length;
|
// cycles when accessed. Everything else runs at full speed. Short-circuit
|
||||||
|
// that whole piece of communications by just accruing the time here if applicable.
|
||||||
|
const HalfCycles penalty(
|
||||||
|
(
|
||||||
|
cycle.operation == CPU::Z80::PartialMachineCycle::Output &&
|
||||||
|
((*cycle.address >> 5) & 7) == 7
|
||||||
|
) ? 6 : 0
|
||||||
|
);
|
||||||
|
const HalfCycles length = cycle.length + penalty;
|
||||||
|
|
||||||
|
time_since_vdp_update_ += length;
|
||||||
|
time_since_sn76489_update_ += length;
|
||||||
|
|
||||||
uint16_t address = cycle.address ? *cycle.address : 0x0000;
|
uint16_t address = cycle.address ? *cycle.address : 0x0000;
|
||||||
switch(cycle.operation) {
|
switch(cycle.operation) {
|
||||||
@ -329,13 +340,13 @@ class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(time_until_interrupt_ > 0) {
|
if(time_until_interrupt_ > 0) {
|
||||||
time_until_interrupt_ -= cycle.length;
|
time_until_interrupt_ -= length;
|
||||||
if(time_until_interrupt_ <= HalfCycles(0)) {
|
if(time_until_interrupt_ <= HalfCycles(0)) {
|
||||||
z80_.set_non_maskable_interrupt_line(true, time_until_interrupt_);
|
z80_.set_non_maskable_interrupt_line(true, time_until_interrupt_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HalfCycles(0);
|
return penalty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush() {
|
void flush() {
|
||||||
|
Loading…
Reference in New Issue
Block a user