From b3788fed411ff59febab9f4152626c443fcf361b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 5 Aug 2017 09:12:17 -0400 Subject: [PATCH] Fixed AY queuing behaviour as handled by the Amstrad. I think I need to come up with clearer semantics here. --- Machines/AmstradCPC/AmstradCPC.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 406f045c9..77b696531 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -108,9 +108,13 @@ class AYDeferrer { cycles_since_update_ += half_cycles; } + /// Enqueues an update-to-now into the AY's deferred queue. + inline void update() { + ay_->run_for(cycles_since_update_.divide_cycles(Cycles(4))); + } + /// Issues a request to the AY to perform all processing up to the current time. inline void flush() { - ay_->run_for(cycles_since_update_.divide_cycles(Cycles(4))); ay_->flush(); } @@ -443,6 +447,7 @@ class i8255PortHandler : public Intel::i8255::PortHandler { switch(port) { case 0: // Port A is connected to the AY's data bus. + ay_.update(); ay_.ay()->set_data_input(value); break; case 1: @@ -628,6 +633,7 @@ class ConcreteMachine: /// Another Z80 entry point; indicates that a partcular run request has concluded. void flush() { // Just flush the AY. + ay_.update() ay_.flush(); }