1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-26 15:32:04 +00:00

Adds the option for a clock conversion to JustInTimeActor and slows the MFP's clock rate.

This commit is contained in:
Thomas Harte 2019-10-28 21:35:10 -04:00
parent 0f2d72c436
commit 1d790ec2a9
4 changed files with 11 additions and 6 deletions

View File

@ -21,14 +21,18 @@
Machines that accumulate HalfCycle time but supply to a Cycle-counted device may supply a
separate @c TargetTimeScale at template declaration.
*/
template <class T, int divider = 1, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class JustInTimeActor {
template <class T, int multiplier = 1, int divider = 1, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class JustInTimeActor {
public:
/// Constructs a new JustInTimeActor using the same construction arguments as the included object.
template<typename... Args> JustInTimeActor(Args&&... args) : object_(std::forward<Args>(args)...) {}
/// Adds time to the actor.
inline void operator += (const LocalTimeScale &rhs) {
time_since_update_ += rhs;
if(multiplier != 1) {
time_since_update_ += rhs * multiplier;
} else {
time_since_update_ += rhs;
}
is_flushed_ = false;
}

View File

@ -656,7 +656,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
return mouse_;
}
using IWMActor = JustInTimeActor<IWM, 1, HalfCycles, Cycles>;
using IWMActor = JustInTimeActor<IWM, 1, 1, HalfCycles, Cycles>;
class VIAPortHandler: public MOS::MOS6522::PortHandler {
public:

View File

@ -32,7 +32,7 @@
namespace Atari {
namespace ST {
const int CLOCK_RATE = 8000000;
const int CLOCK_RATE = 8021247;
/*!
A receiver for the Atari ST's "intelligent keyboard" commands, which actually cover
@ -604,7 +604,8 @@ class ConcreteMachine:
JustInTimeActor<Video> video_;
HalfCycles cycles_until_video_event_;
JustInTimeActor<Motorola::MFP68901::MFP68901> mfp_;
// The MFP runs at 819200/2673749ths of the CPU clock rate.
JustInTimeActor<Motorola::MFP68901::MFP68901, 819200, 2673749> mfp_;
JustInTimeActor<Motorola::ACIA::ACIA, 16> keyboard_acia_;
JustInTimeActor<Motorola::ACIA::ACIA, 16> midi_acia_;

View File

@ -397,7 +397,7 @@ class ConcreteMachine:
}
CPU::Z80::Processor<ConcreteMachine, false, false> z80_;
JustInTimeActor<TI::TMS::TMS9918, 1, HalfCycles> vdp_;
JustInTimeActor<TI::TMS::TMS9918, 1, 1, HalfCycles> vdp_;
Concurrency::DeferringAsyncTaskQueue audio_queue_;
TI::SN76489 sn76489_;