From ef636da86620ebc489c126af2bcde7cd4dbb19d1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 15 Apr 2021 21:19:21 -0400 Subject: [PATCH] Attempts 48/128kb floating bus behaviour. --- Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp index d4e289c2a..165099989 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp @@ -321,6 +321,15 @@ template class ConcreteMachine: } case PartialMachineCycle::Read: + if constexpr (model == Model::SixteenK) { + // Assumption: with nothing mapped above 0x8000 on the 16kb Spectrum, + // read the floating bus. + if(address >= 0x8000) { + *cycle.value = video_->get_floating_value(); + break; + } + } + *cycle.value = read_pointers_[address >> 14][address]; if constexpr (model >= Model::Plus2a) { @@ -413,10 +422,13 @@ template class ConcreteMachine: } break; - case PartialMachineCycle::Input: + case PartialMachineCycle::Input: { + bool did_match = false; *cycle.value = 0xff; if(!(address&1)) { + did_match = true; + // Port FE: // // address b8+: mask of keyboard lines to select @@ -446,6 +458,8 @@ template class ConcreteMachine: if constexpr (model >= Model::OneTwoEightK) { if((address & 0xc002) == 0xc000) { + did_match = true; + // Read from AY register. update_audio(); *cycle.value &= GI::AY38910::Utility::read(ay_); @@ -469,7 +483,13 @@ template class ConcreteMachine: break; } } - break; + + if constexpr (model < Model::Plus2) { + if(!did_match) { + *cycle.value = video_->get_floating_value(); + } + } + } break; } return HalfCycles(0);