--- nono/vm/areaset.cpp 2026/04/29 17:04:28 1.1 +++ nono/vm/areaset.cpp 2026/04/29 17:05:29 1.1.1.10 @@ -1,65 +1,79 @@ // // nono -// Copyright (C) 2017 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + +// +// エリアセット // #include "areaset.h" +#include "mpu.h" +#include "x68kio.h" +// コンストラクタ AreaSetDevice::AreaSetDevice() + : inherited(OBJ_AREASET) { - logname = "area"; - devname = "AreaSet"; - devaddr = baseaddr; - devlen = 0x2000; } +// デストラクタ AreaSetDevice::~AreaSetDevice() { } -uint64 -AreaSetDevice::Read8(uint32 addr) +// 初期化 +bool +AreaSetDevice::Init() { - switch (addr) { - case 0xe86001: - return limit; + if (inherited::Init() == false) { + return false; } - return (uint64)-1; + + x68kio = GetX68kIODevice(); + + return true; } -uint64 -AreaSetDevice::Read16(uint32 addr) +// リセット +void +AreaSetDevice::ResetHard(bool poweron) { - return 0xff00 | Read8(addr + 1); + // リセットでどうなるかは分からないけど、 + // さすがに不定ではないだろう。 + x68kio->SetAreaset(0); } -uint64 -AreaSetDevice::Write8(uint32 addr, uint32 data) +busdata +AreaSetDevice::ReadPort(uint32 offset) { - switch (addr) { - case 0xe86001: - putlog(0, "未実装エリアセット書き込み $%02x", data); - limit = data; - return 0; - default: - break; - } - return (uint64)-1; + putlog(2, "Read $%06x (BusErr)", mpu->GetPaddr()); + return BusData::BusErr; } -uint64 -AreaSetDevice::Write16(uint32 addr, uint32 data) + +busdata +AreaSetDevice::WritePort(uint32 offset, uint32 data) { - return Write8(addr + 1, data); + putlog(1, "Write $%06x <- $%02x", mpu->GetPaddr(), data); + x68kio->SetAreaset(data); + + const busdata wait = busdata::Wait(7 * 40_nsec); + busdata r = wait; + r |= BusData::Size1; + return r; } -uint64 -AreaSetDevice::Peek8(uint32 addr) +busdata +AreaSetDevice::PeekPort(uint32 offset) { - switch (addr) { - case 0xe86001: - return limit; - default: - return 0xff; - } + return BusData::BusErr; +} + +bool +AreaSetDevice::PokePort(uint32 offset, uint32 data) +{ + // とりあえず + return false; }