From 3925eee575da244003908662622686f8d47758ea Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 21 Mar 2021 21:03:35 -0400 Subject: [PATCH] Attempts more relaxed decoding of AY accesses. --- Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp | 34 ++++++++------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp index 5448a54bf..264bc9df8 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp @@ -204,20 +204,16 @@ template class ConcreteMachine: update_memory_map(); } - switch(address) { - default: break; + if((address & 0xc002) == 0xc000) { + // Select AY register. + update_audio(); + GI::AY38910::Utility::select_register(ay_, *cycle.value); + } - case 0xfffd: - // Select AY register. - update_audio(); - GI::AY38910::Utility::select_register(ay_, *cycle.value); - break; - - case 0xbffd: - // Write to AY register. - update_audio(); - GI::AY38910::Utility::write_data(ay_, *cycle.value); - break; + if((address & 0xc002) == 0x8000) { + // Write to AY register. + update_audio(); + GI::AY38910::Utility::write_data(ay_, *cycle.value); } break; @@ -252,14 +248,10 @@ template class ConcreteMachine: } } - switch(address) { - default: break; - - case 0xfffd: - // Read from AY register. - update_audio(); - *cycle.value &= GI::AY38910::Utility::read_data(ay_); - break; + if((address & 0xc002) == 0xc000) { + // Read from AY register. + update_audio(); + *cycle.value &= GI::AY38910::Utility::read_data(ay_); } break; }