From bcb7bb5cce5f01601e8b8d569a273468589fbf53 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 26 Jul 2021 17:02:30 -0400 Subject: [PATCH] Improves logging further. To investigate the new perpetual loop. --- .../Implementation/6526Implementation.hpp | 2 ++ .../6526/Implementation/6526Storage.hpp | 28 +++++++++++-------- Machines/Amiga/Amiga.cpp | 8 ++++-- Machines/Amiga/Chipset.cpp | 8 ++++++ 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Components/6526/Implementation/6526Implementation.hpp b/Components/6526/Implementation/6526Implementation.hpp index f35bd1329..b88e7351a 100644 --- a/Components/6526/Implementation/6526Implementation.hpp +++ b/Components/6526/Implementation/6526Implementation.hpp @@ -263,6 +263,8 @@ void MOS6526::run_for(const HalfCycles half_cycles) { template void MOS6526::advance_tod(int count) { + if(!count) return; + if constexpr(personality == Personality::P8250) { // The 8250 uses a simple binary counter to replace the // 6526's time-of-day clock. So this is easy. diff --git a/Components/6526/Implementation/6526Storage.hpp b/Components/6526/Implementation/6526Storage.hpp index d177108b4..412117881 100644 --- a/Components/6526/Implementation/6526Storage.hpp +++ b/Components/6526/Implementation/6526Storage.hpp @@ -30,15 +30,17 @@ struct MOS6526Storage { uint16_t reload = 0; uint16_t value = 0; uint8_t control = 0; - bool is_counting = false; template void set_reload(uint8_t v) { reload = (reload & (0xff00 >> shift)) | uint16_t(v << shift); if constexpr (shift == 8) { - if(!is_counting) { - is_counting = true; + if(!(control&1)) { value = reload; + + if(control&8) { + control |= 1; // At a guess: start one-shot automatically (?) + } } } } @@ -48,20 +50,22 @@ struct MOS6526Storage { if(v & 0x10) { value = reload; } - is_counting |= (v & 0x18) == 0x10; + + // Force reload + one-shot => start counting (?) + if((v & 0x18) == 0x18) { + control |= 1; + } } int subtract(int count) { if(control & 8) { // One-shot. - if(is_counting) { - if(value < count) { - value = reload; - is_counting = false; - return 1; - } else { - value -= count; - } + if(value < count) { + value = reload; + control &= 0xfe; + return 1; + } else { + value -= count; } return 0; } else { diff --git a/Machines/Amiga/Amiga.cpp b/Machines/Amiga/Amiga.cpp index 5a5bf2208..b8be77e45 100644 --- a/Machines/Amiga/Amiga.cpp +++ b/Machines/Amiga/Amiga.cpp @@ -124,7 +124,7 @@ class ConcreteMachine: // directly to the chip enables. if((address & 0xe0'0000) == 0xa0'0000) { const int reg = address >> 8; - LOG("CIA access: " << PADHEX(4) << *cycle.address); + LOG("CIA " << (cycle.operation & Microcycle::Read ? "read " : "write ") << PADHEX(4) << *cycle.address); if(cycle.operation & Microcycle::Read) { uint16_t result = 0xffff; @@ -142,7 +142,11 @@ class ConcreteMachine: if(cycle.operation & Microcycle::Read) { cycle.set_value16(0xffff); } - LOG("Unmapped " << (cycle.operation & Microcycle::Read ? "read from " : "write to ") << PADHEX(4) << *cycle.address << " of " << cycle.value16()); + + // Don't log for the region that is definitely just ROM this machine doesn't have. + if(address < 0xf0'0000) { + LOG("Unmapped " << (cycle.operation & Microcycle::Read ? "read from " : "write to ") << PADHEX(4) << *cycle.address << " of " << cycle.value16()); + } } } } else { diff --git a/Machines/Amiga/Chipset.cpp b/Machines/Amiga/Chipset.cpp index 87fd1610b..8ed9216ea 100644 --- a/Machines/Amiga/Chipset.cpp +++ b/Machines/Amiga/Chipset.cpp @@ -133,6 +133,14 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) { cycle.set_value16(0x8080); break; + case Write(0x034): + LOG("TODO: pot port start"); + break; + case Read(0x016): + LOG("TODO: pot port read"); + cycle.set_value16(0xff00); + break; + // Disk DMA. case Write(0x020): case Write(0x022): case Write(0x024): case Write(0x026):