mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Ensures serial lines know their writer's clock rate.
This commit is contained in:
parent
d7982aa84e
commit
f86dc082bb
@ -13,7 +13,10 @@
|
||||
|
||||
using namespace Motorola::ACIA;
|
||||
|
||||
ACIA::ACIA() {}
|
||||
ACIA::ACIA(int clock_rate) {
|
||||
transmit.set_writer_clock_rate(clock_rate);
|
||||
request_to_send.set_writer_clock_rate(clock_rate);
|
||||
}
|
||||
|
||||
uint8_t ACIA::read(int address) {
|
||||
if(address&1) {
|
||||
|
@ -19,7 +19,7 @@ namespace ACIA {
|
||||
|
||||
class ACIA: public ClockingHint::Source {
|
||||
public:
|
||||
ACIA();
|
||||
ACIA(int clock_rate);
|
||||
|
||||
/*!
|
||||
Reads from the ACIA.
|
||||
|
@ -10,6 +10,10 @@
|
||||
|
||||
using namespace Serial;
|
||||
|
||||
void Line::set_writer_clock_rate(int clock_rate) {
|
||||
clock_rate_ = clock_rate;
|
||||
}
|
||||
|
||||
void Line::advance_writer(int cycles) {
|
||||
remaining_delays_ = std::max(remaining_delays_ - cycles, 0);
|
||||
while(!events_.empty()) {
|
||||
|
@ -24,6 +24,8 @@ namespace Serial {
|
||||
*/
|
||||
class Line {
|
||||
public:
|
||||
void set_writer_clock_rate(int clock_rate);
|
||||
|
||||
/// Advances the read position by @c cycles relative to the writer's
|
||||
/// clock rate.
|
||||
void advance_writer(int cycles);
|
||||
@ -61,6 +63,7 @@ class Line {
|
||||
std::vector<Event> events_;
|
||||
int remaining_delays_ = 0;
|
||||
bool level_ = false;
|
||||
int clock_rate_ = 0;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -39,8 +39,8 @@ class ConcreteMachine:
|
||||
public:
|
||||
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
mc68000_(*this),
|
||||
keyboard_acia_(),
|
||||
midi_acia_(),
|
||||
keyboard_acia_(CLOCK_RATE / 10),
|
||||
midi_acia_(CLOCK_RATE / 10),
|
||||
ay_(audio_queue_),
|
||||
speaker_(ay_) {
|
||||
set_clock_rate(CLOCK_RATE);
|
||||
|
Loading…
Reference in New Issue
Block a user