--- nono/vm/cmmu.h 2026/04/29 17:04:35 1.1 +++ nono/vm/cmmu.h 2026/04/29 17:06:01 1.1.1.8 @@ -4,15 +4,18 @@ // Licensed under nono-license.txt // +// // M88200 CMMU の I/O デバイス部分 +// #pragma once #include "device.h" -#include "m88200.h" +#include + +class m88200; -class CMMUDevice - : public IODevice +class CMMUDevice : public IODevice { using inherited = IODevice; @@ -43,26 +46,29 @@ class CMMUDevice bool Init() override; - uint64 Read32(uint32 addr) override; - uint64 Write32(uint32 addr, uint32 data) override; - uint64 Peek8(uint32 addr) override; + busdata Read(busaddr addr) override; + busdata Write(busaddr addr, uint32 data) override; + busdata Peek1(uint32 addr) override; private: // アドレスデコーダ static uint32 Decoder(uint32 addr); + // Peek1() の下請け + uint32 Peek4(uint32 addr) const; + // 指定された ID の CMMU(m88200) を返す。なければ NULL を返す。 m88200 *GetCMMU(uint id) const { - if (id >= countof(cmmus) || cmmus[id] == NULL) { + if (id >= cmmus.size()) { return NULL; } return cmmus[id]; } - // CMMU へのリンク (最大 4 MPU) - m88200 *cmmus[8] {}; - // Peek8() の下請け - uint32 Peek32(uint32 addr) const; + // CMMU へのリンク (最大 4 MPU) + std::array cmmus {}; }; -extern std::unique_ptr gCMMU; +inline CMMUDevice *GetCMMUDevice() { + return Object::GetObject(OBJ_CMMUIO); +}