mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 16:31:31 +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;
|
||||
|
||||
ACIA::ACIA(int clock_rate) {
|
||||
transmit.set_writer_clock_rate(clock_rate);
|
||||
request_to_send.set_writer_clock_rate(clock_rate);
|
||||
const HalfCycles ACIA::SameAsTransmit;
|
||||
|
||||
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) {
|
||||
@ -149,6 +153,6 @@ ClockingHint::Preference ACIA::preferred_clocking() {
|
||||
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_;
|
||||
}
|
||||
|
@ -19,7 +19,13 @@ namespace ACIA {
|
||||
|
||||
class ACIA: public ClockingHint::Source {
|
||||
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.
|
||||
@ -39,9 +45,13 @@ class ACIA: public ClockingHint::Source {
|
||||
*/
|
||||
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.
|
||||
Serial::Line receive;
|
||||
@ -69,6 +79,9 @@ class ACIA: public ClockingHint::Source {
|
||||
bool interrupt_request_ = false;
|
||||
|
||||
ClockingHint::Preference preferred_clocking() final;
|
||||
|
||||
HalfCycles transmit_clock_rate_;
|
||||
HalfCycles receive_clock_rate_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ class ConcreteMachine:
|
||||
public:
|
||||
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
mc68000_(*this),
|
||||
keyboard_acia_(CLOCK_RATE / 10),
|
||||
midi_acia_(CLOCK_RATE / 10),
|
||||
keyboard_acia_(Cycles(500000)),
|
||||
midi_acia_(Cycles(500000)),
|
||||
ay_(audio_queue_),
|
||||
speaker_(ay_) {
|
||||
set_clock_rate(CLOCK_RATE);
|
||||
@ -372,8 +372,8 @@ class ConcreteMachine:
|
||||
HalfCycles cycles_until_video_event_;
|
||||
|
||||
JustInTimeActor<Motorola::MFP68901::MFP68901> mfp_;
|
||||
JustInTimeActor<Motorola::ACIA::ACIA, 10> keyboard_acia_;
|
||||
JustInTimeActor<Motorola::ACIA::ACIA, 10> midi_acia_;
|
||||
JustInTimeActor<Motorola::ACIA::ACIA, 16> keyboard_acia_;
|
||||
JustInTimeActor<Motorola::ACIA::ACIA, 16> midi_acia_;
|
||||
|
||||
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
||||
GI::AY38910::AY38910 ay_;
|
||||
|
Loading…
Reference in New Issue
Block a user