--- nono/vm/xpbus.cpp 2026/04/29 17:05:18 1.1.1.1 +++ nono/vm/xpbus.cpp 2026/04/29 17:05:38 1.1.1.4 @@ -8,6 +8,21 @@ // XP プロセッサの物理バス // +// IODevice +// +-- MainbusDevice (InitMainbus() と Read/Write に FC 版がある) +// | +-- Mainbus24Device +// | | +-- LunaMainbus +// | | | +-- Luna1Mainbus +// | | | +-- Luna88kMainbus +// | | +-- NewsMainbus +// | | +-- Virt68kMainbus +// | +-- X68kMainbus +// | +-- X68kIODevice +// | +// | +-------------+ +// +-------| XPbusDevice | (これはただの IODevice) +// +-------------+ + // 00000H +-------------------+ // | 3Port RAM (128KB) | // 20000H +-------------------+ @@ -46,10 +61,6 @@ XPbusDevice::~XPbusDevice() bool XPbusDevice::Init() { - if (inherited::Init() == false) { - return false; - } - nopio = GetNopIODevice(); subram = GetSubRAMDevice(); return true; @@ -83,67 +94,36 @@ XPbusDevice::SearchDevice(uint32 addr) c return nopio; } -uint64 -XPbusDevice::Read8(uint32 addr) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Read8(addr); -} - -uint64 -XPbusDevice::Read16(uint32 addr) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Read16(addr); -} - -uint64 -XPbusDevice::Read32(uint32 addr) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Read32(addr); -} - -uint64 -XPbusDevice::Write8(uint32 addr, uint32 data) +busdata +XPbusDevice::Read1(uint32 addr) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Write8(addr, data); + return d->Read1(addr); } -uint64 -XPbusDevice::Write16(uint32 addr, uint32 data) +busdata +XPbusDevice::Write1(uint32 addr, uint32 data) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Write16(addr, data); + return d->Write1(addr, data); } -uint64 -XPbusDevice::Write32(uint32 addr, uint32 data) +busdata +XPbusDevice::Peek1(uint32 addr) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Write32(addr, data); + return d->Peek1(addr); } -uint64 -XPbusDevice::Peek8(uint32 addr) +bool +XPbusDevice::Poke1(uint32 addr, uint32 data) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Peek8(addr); -} - -// このアドレスを担当する次段の IODevice を返す (IOContainerDevice 用) -IODevice * -XPbusDevice::GetDevice(uint32 addr) const -{ - return SearchDevice(addr & 0x000fffff); + return d->Poke1(addr, data); } // RMCR レジスタを取得する @@ -179,62 +159,35 @@ XPRAMDevice::~XPRAMDevice() { } -uint64 -XPRAMDevice::Read8(uint32 addr) -{ - addr &= 0x1ff; - return ram[addr]; -} - -uint64 -XPRAMDevice::Read16(uint32 addr) -{ - putlog(0, "should not be called?"); - return (uint64)-1; -} - -uint64 -XPRAMDevice::Read32(uint32 addr) +busdata +XPRAMDevice::Read1(uint32 addr) { - putlog(0, "should not be called?"); - return (uint64)-1; + uint32 offset = addr & 0x1ff; + busdata data = ram[offset]; + return data; } -uint64 -XPRAMDevice::Write8(uint32 addr, uint32 data) +busdata +XPRAMDevice::Write1(uint32 addr, uint32 data) { - addr &= 0x1ff; - ram[addr] = data; + uint32 offset = addr & 0x1ff; + ram[offset] = data; return 0; } -uint64 -XPRAMDevice::Write16(uint32 addr, uint32 data) -{ - putlog(0, "should not be called?"); - return (uint64)-1; -} - -uint64 -XPRAMDevice::Write32(uint32 addr, uint32 data) -{ - putlog(0, "should not be called?"); - return (uint64)-1; -} - -uint64 -XPRAMDevice::Peek8(uint32 addr) +busdata +XPRAMDevice::Peek1(uint32 addr) { addr &= 0x1ff; return ram[addr]; } -uint64 -XPRAMDevice::Poke8(uint32 addr, uint32 data) +bool +XPRAMDevice::Poke1(uint32 addr, uint32 data) { if ((int32)data >= 0) { addr &= 0x1ff; ram[addr] = data; } - return 0; + return true; }