1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-04-14 18:37:11 +00:00

Adopt granular flushing widely.

This commit is contained in:
Thomas Harte 2022-07-08 16:04:32 -04:00
parent b03d91d5dd
commit b097b1296b
16 changed files with 101 additions and 58 deletions

View File

@ -176,10 +176,6 @@ class ConcreteMachine:
return total_length - cycle.length;
}
void flush() {
chipset_.flush();
}
private:
CPU::MC68000Mk2::Processor<ConcreteMachine, true, true> mc68000_;
@ -220,7 +216,7 @@ class ConcreteMachine:
}
void flush_output(Output) final {
flush();
chipset_.flush();
}
// MARK: - MachineTypes::MouseMachine.

View File

@ -1048,11 +1048,15 @@ template <bool has_fdc> class ConcreteMachine:
return HalfCycles(0);
}
/// Another Z80 entry point; indicates that a partcular run request has concluded.
void flush() {
/// Fields requests to pump all output.
void flush_output(Output output) final {
// Just flush the AY.
ay_.update();
ay_.flush();
if(int(output) & int(Output::Audio)) {
ay_.update();
ay_.flush();
}
// Always flush the FDC.
flush_fdc();
}

View File

@ -810,11 +810,16 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
return Cycles(1);
}
void flush() {
update_video();
update_audio();
void flush_output(Output output) final {
update_just_in_time_cards();
audio_queue_.perform();
if(int(output) & int(Output::Video)) {
update_video();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
void run_for(const Cycles cycles) final {

View File

@ -326,13 +326,17 @@ class ConcreteMachine:
m65816_.run_for(cycles);
}
void flush() {
video_.flush();
void flush_output(Output output) final {
iwm_.flush();
adb_glu_.flush();
AudioUpdater updater(this);
audio_queue_.perform();
if(int(output) & int(Output::Video)) {
video_.flush();
}
if(int(output) & int(Output::Audio)) {
AudioUpdater updater(this);
audio_queue_.perform();
}
}
void set_scan_target(Outputs::Display::ScanTarget *target) override {

View File

@ -190,7 +190,6 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
void run_for(const Cycles cycles) final {
mc68000_.run_for(cycles);
flush();
}
using Microcycle = CPU::MC68000Mk2::Microcycle;
@ -366,7 +365,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
return delay;
}
void flush() {
void flush_output(Output) {
// Flush the video before the audio queue; in a Mac the
// video is responsible for providing part of the
// audio signal, so the two aren't as distinct as in

View File

@ -174,7 +174,7 @@ class ConcreteMachine:
bus_->apply_confidence(confidence_counter_);
}
void flush() {
void flush_output(Output) final {
bus_->flush();
}

View File

@ -154,7 +154,6 @@ class ConcreteMachine:
}
mc68000_.run_for(cycles);
flush();
}
// MARK: MC68000::BusHandler
@ -414,14 +413,19 @@ class ConcreteMachine:
return HalfCycles(0);
}
void flush() {
void flush_output(Output output) final {
dma_.flush();
mfp_.flush();
keyboard_acia_.flush();
midi_acia_.flush();
video_.flush();
update_audio();
audio_queue_.perform();
if(int(output) & int(Output::Video)) {
video_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
private:

View File

@ -342,10 +342,14 @@ class ConcreteMachine:
return penalty;
}
void flush() {
vdp_.flush();
update_audio();
audio_queue_.perform();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
vdp_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
float get_confidence() final {

View File

@ -620,9 +620,13 @@ class ConcreteMachine:
return Cycles(1);
}
void flush() {
update_video();
mos6560_.flush();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
update_video();
}
if(int(output) & int(Output::Audio)) {
mos6560_.flush();
}
}
void run_for(const Cycles cycles) final {

View File

@ -501,10 +501,14 @@ template <bool has_scsi_bus> class ConcreteMachine:
return Cycles(int(cycles));
}
forceinline void flush() {
video_.flush();
update_audio();
audio_queue_.perform();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
video_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {

View File

@ -539,10 +539,14 @@ template <bool has_disk_controller, bool is_6mhz> class ConcreteMachine:
return penalty;
}
void flush() {
nick_.flush();
update_audio();
audio_queue_.perform();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
nick_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
private:

View File

@ -615,10 +615,14 @@ class ConcreteMachine:
return addition;
}
void flush() {
vdp_.flush();
update_audio();
audio_queue_.perform();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
vdp_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
void set_keyboard_line(int line) {

View File

@ -392,9 +392,6 @@ class ConcreteMachine:
return HalfCycles(0);
}
void flush() {
}
const std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() final {
return joysticks_;
}

View File

@ -578,9 +578,13 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS
return Cycles(1);
}
forceinline void flush() {
video_.flush();
via_.flush();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
video_.flush();
}
if(int(output) & int(Output::Audio)) {
via_.flush();
}
diskii_.flush();
}

View File

@ -292,11 +292,16 @@ template<bool is_zx81> class ConcreteMachine:
return HalfCycles(0);
}
forceinline void flush() {
video_.flush();
void flush_output(Output output) final {
if(int(output) & int(Output::Video)) {
video_.flush();
}
if constexpr (is_zx81) {
update_audio();
audio_queue_.perform();
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
}
}

View File

@ -263,10 +263,15 @@ template<Model model> class ConcreteMachine:
}
}
void flush() {
video_.flush();
update_audio();
audio_queue_.perform();
void flush_output(Output output) override {
if(int(output) & int(Output::Video)) {
video_.flush();
}
if(int(output) & int(Output::Audio)) {
update_audio();
audio_queue_.perform();
}
if constexpr (model == Model::Plus3) {
fdc_.flush();