1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Merge pull request #965 from TomHarte/DaveDivider

Ensure two-cycle pauses in 12MHz mode.
This commit is contained in:
Thomas Harte 2021-07-04 21:13:05 -04:00 committed by GitHub
commit e98165a657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,12 +272,12 @@ template <bool has_disk_controller> class ConcreteMachine:
case PartialMachineCycle::ReadStart: case PartialMachineCycle::ReadStart:
case PartialMachineCycle::WriteStart: case PartialMachineCycle::WriteStart:
if(!is_video_[address >> 14] && wait_mode_ == WaitMode::OnAllAccesses) { if(!is_video_[address >> 14] && wait_mode_ == WaitMode::OnAllAccesses) {
penalty = HalfCycles(2); penalty = dave_delay_;
} }
break; break;
case PartialMachineCycle::ReadOpcodeStart: case PartialMachineCycle::ReadOpcodeStart:
if(!is_video_[address >> 14] && wait_mode_ != WaitMode::None) { if(!is_video_[address >> 14] && wait_mode_ != WaitMode::None) {
penalty = HalfCycles(2); penalty = dave_delay_;
} else { } else {
// Query Nick for the amount of delay that would occur with one cycle left // Query Nick for the amount of delay that would occur with one cycle left
// in this read opcode. // in this read opcode.
@ -435,6 +435,11 @@ template <bool has_disk_controller> class ConcreteMachine:
case 0: wait_mode_ = WaitMode::OnAllAccesses; break; case 0: wait_mode_ = WaitMode::OnAllAccesses; break;
case 1: wait_mode_ = WaitMode::OnM1; break; case 1: wait_mode_ = WaitMode::OnM1; break;
} }
// Dave delays (i.e. those affecting memory areas not associated with Nick)
// are one cycle in 8Mhz mode, two cycles in 12Mhz mode.
dave_delay_ = HalfCycles(2 + (*cycle.value)&2);
[[fallthrough]]; [[fallthrough]];
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa0: case 0xa1: case 0xa2: case 0xa3:
@ -691,6 +696,8 @@ template <bool has_disk_controller> class ConcreteMachine:
Outputs::Speaker::LowpassSpeaker<Dave::Audio> speaker_; Outputs::Speaker::LowpassSpeaker<Dave::Audio> speaker_;
HalfCycles time_since_audio_update_; HalfCycles time_since_audio_update_;
HalfCycles dave_delay_ = HalfCycles(2);
// The divider supplied to the JustInTimeActor and the manual divider used in // The divider supplied to the JustInTimeActor and the manual divider used in
// update_audio() should match. // update_audio() should match.
static constexpr int dave_divider = 8; static constexpr int dave_divider = 8;