From eb8a2de5d6c905fbc70af3a1bacb7c64b75cc8d4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 15 May 2017 07:38:59 -0400 Subject: [PATCH] Settled definitively on `flush` as more communicative than `synchronise` (and slightly more locale neutral); culled some more duplication from the Z80. --- Components/6560/6560.hpp | 2 +- Concurrency/AsyncTaskQueue.hpp | 2 +- Machines/Atari2600/Cartridges/Cartridge.hpp | 2 +- Machines/Commodore/Vic-20/Vic20.hpp | 2 +- Machines/Electron/Electron.cpp | 2 +- Machines/Electron/Electron.hpp | 2 +- Machines/Oric/Oric.cpp | 6 +++--- Machines/Oric/Oric.hpp | 4 ++-- Processors/6502/6502.hpp | 6 +++--- Processors/Z80/Z80.hpp | 5 +---- 10 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Components/6560/6560.hpp b/Components/6560/6560.hpp index 0067dec43..88ce2dbc2 100644 --- a/Components/6560/6560.hpp +++ b/Components/6560/6560.hpp @@ -323,7 +323,7 @@ template 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. diff --git a/Concurrency/AsyncTaskQueue.hpp b/Concurrency/AsyncTaskQueue.hpp index aa53dd954..f695cd2a1 100644 --- a/Concurrency/AsyncTaskQueue.hpp +++ b/Concurrency/AsyncTaskQueue.hpp @@ -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 { diff --git a/Machines/Atari2600/Cartridges/Cartridge.hpp b/Machines/Atari2600/Cartridges/Cartridge.hpp index 98bf11be9..fa445fcd1 100644 --- a/Machines/Atari2600/Cartridges/Cartridge.hpp +++ b/Machines/Atari2600/Cartridges/Cartridge.hpp @@ -161,7 +161,7 @@ template class Cartridge: return cycles_run_for / 3; } - void synchronise() { + void flush() { update_audio(); update_video(); speaker_->flush(); diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index e73c2e391..4b3f7cf19 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -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); diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 3ca873da2..207eac6c7 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -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(); diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 3cc7a9d22..8bcbea878 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -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); diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 8a9979d96..8fbc8c98b 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -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; diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 7ce8d8941..cef8d56ac 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -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 tape; std::shared_ptr keyboard; - void synchronise(); + void flush(); private: void update_ay(); diff --git a/Processors/6502/6502.hpp b/Processors/6502/6502.hpp index b22d2e01c..b170cee36 100644 --- a/Processors/6502/6502.hpp +++ b/Processors/6502/6502.hpp @@ -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 Processor: public MicroOpScheduler { bus_address_ = busAddress; bus_value_ = busValue; - static_cast(this)->synchronise(); + static_cast(this)->flush(); } /*! @@ -1097,7 +1097,7 @@ template class Processor: public MicroOpScheduler { Users of the 6502 template may override this. */ - void synchronise() {} + void flush() {} /*! Gets the value of a register. diff --git a/Processors/Z80/Z80.hpp b/Processors/Z80/Z80.hpp index 8e260f633..1971a9343 100644 --- a/Processors/Z80/Z80.hpp +++ b/Processors/Z80/Z80.hpp @@ -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 Processor: public MicroOpScheduler { 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_; }; }