1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Eliminated redundant uses of ClockReceiver and sought to ensure that proper run_fors are inherited all the way down.

This commit is contained in:
Thomas Harte 2017-07-25 20:09:13 -04:00
parent 8d1dacd951
commit a1e9a54765
13 changed files with 18 additions and 8 deletions

View File

@ -11,7 +11,6 @@
#include "../../Storage/Disk/DiskController.hpp"
#include "../../NumberTheory/CRC.hpp"
#include "../ClockReceiver.hpp"
namespace WD {
@ -19,7 +18,7 @@ namespace WD {
Provides an emulation of various Western Digital drive controllers, including the
WD1770, WD1772, FDC1773 and FDC1793.
*/
class WD1770: public ClockReceiver<WD1770>, public Storage::Disk::Controller {
class WD1770: public Storage::Disk::Controller {
public:
enum Personality {
P1770, // implies automatic motor-on management, with Type 2 commands offering a spin-up disable
@ -45,6 +44,7 @@ class WD1770: public ClockReceiver<WD1770>, public Storage::Disk::Controller {
/// Runs the controller for @c number_of_cycles cycles.
void run_for(const Cycles &cycles);
using Storage::Disk::Controller::run_for;
enum Flag: uint8_t {
NotReady = 0x80,

View File

@ -105,6 +105,7 @@ template <class T> class MOS6532: public ClockReceiver<MOS6532<T>> {
return 0xff;
}
using ClockReceiver<MOS6532<T>>::run_for;
inline void run_for(const Cycles &cycles) {
unsigned int number_of_cycles = (unsigned int)cycles.as_int();

View File

@ -147,6 +147,7 @@ template <class T> class MOS6560: public ClockReceiver<MOS6560<T>> {
}
}
using ClockReceiver<MOS6560<T>>::run_for;
/*!
Runs for cycles. Derr.
*/

View File

@ -31,6 +31,7 @@ class TIA: public ClockReceiver<TIA> {
Advances the TIA by @c cycles. Any queued setters take effect in the first cycle performed.
*/
void run_for(const Cycles &cycles);
using ClockReceiver<TIA>::run_for;
void set_output_mode(OutputMode output_mode);
void set_sync(bool sync);

View File

@ -35,6 +35,7 @@ class VideoOutput: public ClockReceiver<VideoOutput> {
/// Produces the next @c cycles of video output.
void run_for(const Cycles &cycles);
using ClockReceiver<VideoOutput>::run_for;
/*!
Writes @c value to the register at @c address. May mutate the results of @c get_next_interrupt,

View File

@ -10,11 +10,10 @@
#define Microdisc_hpp
#include "../../Components/1770/1770.hpp"
#include "../../Components/ClockReceiver.hpp"
namespace Oric {
class Microdisc: public ClockReceiver<Microdisc>, public WD::WD1770 {
class Microdisc: public WD::WD1770 {
public:
Microdisc();
@ -26,6 +25,7 @@ class Microdisc: public ClockReceiver<Microdisc>, public WD::WD1770 {
bool get_interrupt_request_line();
void run_for(const Cycles &cycles);
using WD::WD1770::run_for;
enum PagingFlags {
BASICDisable = (1 << 0),

View File

@ -19,6 +19,7 @@ class VideoOutput: public ClockReceiver<VideoOutput> {
VideoOutput(uint8_t *memory);
std::shared_ptr<Outputs::CRT::CRT> get_crt();
void run_for(const Cycles &cycles);
using ClockReceiver<VideoOutput>::run_for;
void set_colour_rom(const std::vector<uint8_t> &rom);
void set_output_device(Outputs::CRT::OutputDevice output_device);

View File

@ -33,6 +33,7 @@ class Video: public ClockReceiver<Video> {
/// Advances time by @c cycles.
void run_for(const HalfCycles &);
using ClockReceiver<Video>::run_for;
/// Forces output to catch up to the current output position.
void flush();

View File

@ -284,6 +284,7 @@ template <class T> class Processor: public ProcessorBase, public ClockReceiver<P
}
public:
using ClockReceiver<Processor<T>>::run_for;
/*!
Runs the 6502 for a supplied number of cycles.

View File

@ -849,6 +849,7 @@ template <class T> class Processor: public ClockReceiver<Processor<T>> {
copy_program(irq_mode2_program, irq_program_[2]);
}
using ClockReceiver<Processor<T>>::run_for;
/*!
Runs the Z80 for a supplied number of cycles.

View File

@ -31,6 +31,7 @@ class DigitalPhaseLockedLoop: public ClockReceiver<DigitalPhaseLockedLoop> {
@c number_of_cycles The time to run the loop for.
*/
void run_for(const Cycles &cycles);
using ClockReceiver<DigitalPhaseLockedLoop>::run_for;
/*!
Announces a pulse at the current time.

View File

@ -14,7 +14,6 @@
#include "PCMSegment.hpp"
#include "PCMPatchedTrack.hpp"
#include "../TimedEventLoop.hpp"
#include "../../Components/ClockReceiver.hpp"
namespace Storage {
namespace Disk {
@ -28,7 +27,7 @@ namespace Disk {
TODO: communication of head size and permissible stepping extents, appropriate simulation of gain.
*/
class Controller: public ClockReceiver<Controller>, public DigitalPhaseLockedLoop::Delegate, public TimedEventLoop {
class Controller: public DigitalPhaseLockedLoop::Delegate, public TimedEventLoop {
protected:
/*!
Constructs a @c DiskDrive that will be run at @c clock_rate and runs its PLL at @c clock_rate*clock_rate_multiplier,
@ -45,6 +44,7 @@ class Controller: public ClockReceiver<Controller>, public DigitalPhaseLockedLoo
Advances the drive by @c number_of_cycles cycles.
*/
void run_for(const Cycles &cycles);
using TimedEventLoop::run_for;
/*!
Sets the current drive.

View File

@ -100,8 +100,8 @@ class TapePlayer: public TimedEventLoop {
bool has_tape();
std::shared_ptr<Storage::Tape::Tape> get_tape();
void run_for(const Cycles &cycles);
using TimedEventLoop::run_for;
void run_for(const Cycles &cycles);
void run_for_input_pulse();
@ -124,13 +124,14 @@ class TapePlayer: public TimedEventLoop {
They can also provide a delegate to be notified upon any change in the input level.
*/
class BinaryTapePlayer: public ClockReceiver<BinaryTapePlayer>, public TapePlayer {
class BinaryTapePlayer: public TapePlayer {
public:
BinaryTapePlayer(unsigned int input_clock_rate);
void set_motor_control(bool enabled);
void set_tape_output(bool set);
bool get_input();
using TapePlayer::run_for;
void run_for(const Cycles &cycles);
class Delegate {