1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-08 10:52:58 +00:00

Settled definitively on flush as more communicative than synchronise (and slightly more locale neutral); culled some more duplication from the Z80.

This commit is contained in:
Thomas Harte 2017-05-15 07:38:59 -04:00
parent f2a1a906ff
commit eb8a2de5d6
10 changed files with 15 additions and 18 deletions

View File

@ -323,7 +323,7 @@ template <class T> class MOS6560 {
/*!
Causes the 6560 to flush as much pending CRT and speaker communications as possible.
*/
inline void synchronise() { update_audio(); speaker_->flush(); }
inline void flush() { update_audio(); speaker_->flush(); }
/*!
Writes to a 6560 register.

View File

@ -22,7 +22,7 @@ namespace Concurrency {
/*!
An async task queue allows a caller to enqueue void(void) functions. Those functions are guaranteed
to be performed serially and asynchronously from the caller. A caller may also request to synchronise,
to be performed serially and asynchronously from the caller. A caller may also request to flush,
causing it to block until all previously-enqueued functions are complete.
*/
class AsyncTaskQueue {

View File

@ -161,7 +161,7 @@ template<class T> class Cartridge:
return cycles_run_for / 3;
}
void synchronise() {
void flush() {
update_audio();
update_video();
speaker_->flush();

View File

@ -169,7 +169,7 @@ class Machine:
// to satisfy CPU::MOS6502::Processor
unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value);
void synchronise() { mos6560_->synchronise(); }
void flush() { mos6560_->flush(); }
// to satisfy CRTMachine::Machine
virtual void setup_output(float aspect_ratio);

View File

@ -343,7 +343,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation
return cycles;
}
void Machine::synchronise() {
void Machine::flush() {
update_display();
update_audio();
speaker_->flush();

View File

@ -89,7 +89,7 @@ class Machine:
// to satisfy CPU::MOS6502::Processor
unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value);
void synchronise();
void flush();
// to satisfy CRTMachine::Machine
virtual void setup_output(float aspect_ratio);

View File

@ -136,9 +136,9 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation
return 1;
}
void Machine::synchronise() {
void Machine::flush() {
update_video();
via_.synchronise();
via_.flush();
}
void Machine::update_video() {
@ -234,7 +234,7 @@ uint8_t Machine::VIA::get_port_input(Port port) {
}
}
void Machine::VIA::synchronise() {
void Machine::VIA::flush() {
ay8910->run_for_cycles(cycles_since_ay_update_);
ay8910->flush();
cycles_since_ay_update_ = 0;

View File

@ -80,7 +80,7 @@ class Machine:
// to satisfy CPU::MOS6502::Processor
unsigned int perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value);
void synchronise();
void flush();
// to satisfy CRTMachine::Machine
virtual void setup_output(float aspect_ratio);
@ -151,7 +151,7 @@ class Machine:
std::unique_ptr<TapePlayer> tape;
std::shared_ptr<Keyboard> keyboard;
void synchronise();
void flush();
private:
void update_ay();

View File

@ -116,7 +116,7 @@ enum MicroOp {
@abstact An abstract base class for emulation of a 6502 processor via the curiously recurring template pattern/f-bounded polymorphism.
@discussion Subclasses should implement @c perform_bus_operation(BusOperation operation, uint16_t address, uint8_t *value) in
order to provide the bus on which the 6502 operates and @c synchronise(), which is called upon completion of a continuous run
order to provide the bus on which the 6502 operates and @c flush(), which is called upon completion of a continuous run
of cycles to allow a subclass to bring any on-demand activities up to date.
Additional functionality can be provided by the host machine by providing a jam handler and inserting jam opcodes where appropriate;
@ -1089,7 +1089,7 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
bus_address_ = busAddress;
bus_value_ = busValue;
static_cast<T *>(this)->synchronise();
static_cast<T *>(this)->flush();
}
/*!
@ -1097,7 +1097,7 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
Users of the 6502 template may override this.
*/
void synchronise() {}
void flush() {}
/*!
Gets the value of a register.

View File

@ -80,7 +80,7 @@ struct MicroOp {
@abstact An abstract base class for emulation of a 6502 processor via the curiously recurring template pattern/f-bounded polymorphism.
@discussion Subclasses should implement @c perform_bus_operation(BusOperation operation, uint16_t address, uint8_t *value) in
order to provide the bus on which the 6502 operates and @c synchronise(), which is called upon completion of a continuous run
order to provide the bus on which the 6502 operates and @c flush(), which is called upon completion of a continuous run
of cycles to allow a subclass to bring any on-demand activities up to date.
Additional functionality can be provided by the host machine by providing a jam handler and inserting jam opcodes where appropriate;
@ -89,12 +89,9 @@ struct MicroOp {
*/
template <class T> class Processor: public MicroOpScheduler<MicroOp> {
private:
RegisterPair bc_, de_, hl_, afDash_, bcDash_, hlDash_, ix_, iy_;
uint8_t a, i, r;
const MicroOp *scheduled_programs_[4];
unsigned int schedule_programs_write_pointer_, schedule_programs_read_pointer_, schedule_program_program_counter_;
};
}