--- nono/vm/areaset.cpp 2026/04/29 17:05:10 1.1.1.6 +++ nono/vm/areaset.cpp 2026/04/29 17:05:29 1.1.1.10 @@ -10,76 +10,70 @@ #include "areaset.h" #include "mpu.h" - -// グローバル参照用 -AreaSetDevice *gAreaSet; +#include "x68kio.h" // コンストラクタ AreaSetDevice::AreaSetDevice() - : inherited("AreaSet") + : inherited(OBJ_AREASET) { - devaddr = baseaddr; - devlen = 0x2000; } // デストラクタ AreaSetDevice::~AreaSetDevice() { - gAreaSet = NULL; +} + +// 初期化 +bool +AreaSetDevice::Init() +{ + if (inherited::Init() == false) { + return false; + } + + x68kio = GetX68kIODevice(); + + return true; } // リセット void AreaSetDevice::ResetHard(bool poweron) { - limit = 0; + // リセットでどうなるかは分からないけど、 + // さすがに不定ではないだろう。 + x68kio->SetAreaset(0); } -uint64 -AreaSetDevice::Read8(uint32 addr) +busdata +AreaSetDevice::ReadPort(uint32 offset) { - switch (addr) { - case 0xe86001: - return limit; - } - return (uint64)-1; + putlog(2, "Read $%06x (BusErr)", mpu->GetPaddr()); + return BusData::BusErr; } -uint64 -AreaSetDevice::Read16(uint32 addr) -{ - return 0xff00 | Read8(addr + 1); -} -uint64 -AreaSetDevice::Write8(uint32 addr, uint32 data) +busdata +AreaSetDevice::WritePort(uint32 offset, uint32 data) { - gMPU->AddCycle(7); // InsideOut p.135 + putlog(1, "Write $%06x <- $%02x", mpu->GetPaddr(), data); + x68kio->SetAreaset(data); - switch (addr) { - case 0xe86001: - putlog(0, "未実装エリアセット書き込み $%02x", data); - limit = data; - return 0; - default: - break; - } - return (uint64)-1; + const busdata wait = busdata::Wait(7 * 40_nsec); + busdata r = wait; + r |= BusData::Size1; + return r; } -uint64 -AreaSetDevice::Write16(uint32 addr, uint32 data) +busdata +AreaSetDevice::PeekPort(uint32 offset) { - return Write8(addr + 1, data); + return BusData::BusErr; } -uint64 -AreaSetDevice::Peek8(uint32 addr) +bool +AreaSetDevice::PokePort(uint32 offset, uint32 data) { - switch (addr) { - case 0xe86001: - return limit; - default: - return 0xff; - } + // とりあえず + return false; }