mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-15 20:31:36 +00:00
The ACIA actually has two clocks, though on an ST they're both 500,000 Hz.
This commit is contained in:
parent
f86dc082bb
commit
8d87e9eb1c
@ -13,9 +13,13 @@
|
|||||||
|
|
||||||
using namespace Motorola::ACIA;
|
using namespace Motorola::ACIA;
|
||||||
|
|
||||||
ACIA::ACIA(int clock_rate) {
|
const HalfCycles ACIA::SameAsTransmit;
|
||||||
transmit.set_writer_clock_rate(clock_rate);
|
|
||||||
request_to_send.set_writer_clock_rate(clock_rate);
|
ACIA::ACIA(HalfCycles transmit_clock_rate, HalfCycles receive_clock_rate) :
|
||||||
|
transmit_clock_rate_(transmit_clock_rate),
|
||||||
|
receive_clock_rate_((receive_clock_rate != SameAsTransmit) ? receive_clock_rate : transmit_clock_rate) {
|
||||||
|
transmit.set_writer_clock_rate(transmit_clock_rate.as_int());
|
||||||
|
request_to_send.set_writer_clock_rate(transmit_clock_rate.as_int());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ACIA::read(int address) {
|
uint8_t ACIA::read(int address) {
|
||||||
@ -149,6 +153,6 @@ ClockingHint::Preference ACIA::preferred_clocking() {
|
|||||||
return (transmit.write_data_time_remaining() > 0) ? ClockingHint::Preference::JustInTime : ClockingHint::Preference::None;
|
return (transmit.write_data_time_remaining() > 0) ? ClockingHint::Preference::JustInTime : ClockingHint::Preference::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACIA::get_interrupt_line() {
|
bool ACIA::get_interrupt_line() const {
|
||||||
return interrupt_request_;
|
return interrupt_request_;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,13 @@ namespace ACIA {
|
|||||||
|
|
||||||
class ACIA: public ClockingHint::Source {
|
class ACIA: public ClockingHint::Source {
|
||||||
public:
|
public:
|
||||||
ACIA(int clock_rate);
|
static constexpr const HalfCycles SameAsTransmit = HalfCycles(0);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Constructs a new instance of ACIA which will receive a transmission clock at a rate of
|
||||||
|
@c transmit_clock_rate, and a receive clock at a rate of @c receive_clock_rate.
|
||||||
|
*/
|
||||||
|
ACIA(HalfCycles transmit_clock_rate, HalfCycles receive_clock_rate = SameAsTransmit);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Reads from the ACIA.
|
Reads from the ACIA.
|
||||||
@ -39,9 +45,13 @@ class ACIA: public ClockingHint::Source {
|
|||||||
*/
|
*/
|
||||||
void write(int address, uint8_t value);
|
void write(int address, uint8_t value);
|
||||||
|
|
||||||
void run_for(HalfCycles);
|
/*!
|
||||||
|
Advances @c transmission_cycles in time, which should be
|
||||||
|
counted relative to the @c transmit_clock_rate.
|
||||||
|
*/
|
||||||
|
void run_for(HalfCycles transmission_cycles);
|
||||||
|
|
||||||
bool get_interrupt_line();
|
bool get_interrupt_line() const;
|
||||||
|
|
||||||
// Input lines.
|
// Input lines.
|
||||||
Serial::Line receive;
|
Serial::Line receive;
|
||||||
@ -69,6 +79,9 @@ class ACIA: public ClockingHint::Source {
|
|||||||
bool interrupt_request_ = false;
|
bool interrupt_request_ = false;
|
||||||
|
|
||||||
ClockingHint::Preference preferred_clocking() final;
|
ClockingHint::Preference preferred_clocking() final;
|
||||||
|
|
||||||
|
HalfCycles transmit_clock_rate_;
|
||||||
|
HalfCycles receive_clock_rate_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ class ConcreteMachine:
|
|||||||
public:
|
public:
|
||||||
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||||
mc68000_(*this),
|
mc68000_(*this),
|
||||||
keyboard_acia_(CLOCK_RATE / 10),
|
keyboard_acia_(Cycles(500000)),
|
||||||
midi_acia_(CLOCK_RATE / 10),
|
midi_acia_(Cycles(500000)),
|
||||||
ay_(audio_queue_),
|
ay_(audio_queue_),
|
||||||
speaker_(ay_) {
|
speaker_(ay_) {
|
||||||
set_clock_rate(CLOCK_RATE);
|
set_clock_rate(CLOCK_RATE);
|
||||||
@ -372,8 +372,8 @@ class ConcreteMachine:
|
|||||||
HalfCycles cycles_until_video_event_;
|
HalfCycles cycles_until_video_event_;
|
||||||
|
|
||||||
JustInTimeActor<Motorola::MFP68901::MFP68901> mfp_;
|
JustInTimeActor<Motorola::MFP68901::MFP68901> mfp_;
|
||||||
JustInTimeActor<Motorola::ACIA::ACIA, 10> keyboard_acia_;
|
JustInTimeActor<Motorola::ACIA::ACIA, 16> keyboard_acia_;
|
||||||
JustInTimeActor<Motorola::ACIA::ACIA, 10> midi_acia_;
|
JustInTimeActor<Motorola::ACIA::ACIA, 16> midi_acia_;
|
||||||
|
|
||||||
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
||||||
GI::AY38910::AY38910 ay_;
|
GI::AY38910::AY38910 ay_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user