mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-21 05:29:13 +00:00
Ensures serial lines know their writer's clock rate.
This commit is contained in:
parent
c4ef33b23f
commit
374439693e
@ -13,7 +13,10 @@
|
|||||||
|
|
||||||
using namespace Motorola::ACIA;
|
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) {
|
uint8_t ACIA::read(int address) {
|
||||||
if(address&1) {
|
if(address&1) {
|
||||||
|
@ -19,7 +19,7 @@ namespace ACIA {
|
|||||||
|
|
||||||
class ACIA: public ClockingHint::Source {
|
class ACIA: public ClockingHint::Source {
|
||||||
public:
|
public:
|
||||||
ACIA();
|
ACIA(int clock_rate);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Reads from the ACIA.
|
Reads from the ACIA.
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
using namespace Serial;
|
using namespace Serial;
|
||||||
|
|
||||||
|
void Line::set_writer_clock_rate(int clock_rate) {
|
||||||
|
clock_rate_ = clock_rate;
|
||||||
|
}
|
||||||
|
|
||||||
void Line::advance_writer(int cycles) {
|
void Line::advance_writer(int cycles) {
|
||||||
remaining_delays_ = std::max(remaining_delays_ - cycles, 0);
|
remaining_delays_ = std::max(remaining_delays_ - cycles, 0);
|
||||||
while(!events_.empty()) {
|
while(!events_.empty()) {
|
||||||
|
@ -24,6 +24,8 @@ namespace Serial {
|
|||||||
*/
|
*/
|
||||||
class Line {
|
class Line {
|
||||||
public:
|
public:
|
||||||
|
void set_writer_clock_rate(int clock_rate);
|
||||||
|
|
||||||
/// Advances the read position by @c cycles relative to the writer's
|
/// Advances the read position by @c cycles relative to the writer's
|
||||||
/// clock rate.
|
/// clock rate.
|
||||||
void advance_writer(int cycles);
|
void advance_writer(int cycles);
|
||||||
@ -61,6 +63,7 @@ class Line {
|
|||||||
std::vector<Event> events_;
|
std::vector<Event> events_;
|
||||||
int remaining_delays_ = 0;
|
int remaining_delays_ = 0;
|
||||||
bool level_ = false;
|
bool level_ = false;
|
||||||
|
int clock_rate_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -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_(),
|
keyboard_acia_(CLOCK_RATE / 10),
|
||||||
midi_acia_(),
|
midi_acia_(CLOCK_RATE / 10),
|
||||||
ay_(audio_queue_),
|
ay_(audio_queue_),
|
||||||
speaker_(ay_) {
|
speaker_(ay_) {
|
||||||
set_clock_rate(CLOCK_RATE);
|
set_clock_rate(CLOCK_RATE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user