--- nono/vm/cmmu.h 2026/04/29 17:04:44 1.1.1.2 +++ nono/vm/cmmu.h 2026/04/29 17:05:18 1.1.1.5 @@ -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; @@ -51,18 +54,21 @@ class CMMUDevice // アドレスデコーダ static uint32 Decoder(uint32 addr); + // Peek8() の下請け + uint32 Peek32(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; +static inline CMMUDevice *GetCMMUDevice() { + return Object::GetObject(OBJ_CMMUIO); +}