--- nono/vm/xpbus.cpp 2026/04/29 17:05:25 1.1.1.2 +++ nono/vm/xpbus.cpp 2026/04/29 17:05:50 1.1.1.5 @@ -42,6 +42,7 @@ // 内蔵 RAM は XPBusDevice の internal_ram[]。 #include "xpbus.h" +#include "nop.h" #include "subram.h" // コンストラクタ @@ -61,10 +62,6 @@ XPbusDevice::~XPbusDevice() bool XPbusDevice::Init() { - if (inherited::Init() == false) { - return false; - } - nopio = GetNopIODevice(); subram = GetSubRAMDevice(); return true; @@ -99,67 +96,35 @@ XPbusDevice::SearchDevice(uint32 addr) c } busdata -XPbusDevice::Read8(uint32 addr) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Read8(addr); -} - -busdata -XPbusDevice::Read16(uint32 addr) +XPbusDevice::Read1(uint32 addr) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Read16(addr); + return d->Read1(addr); } busdata -XPbusDevice::Read32(uint32 addr) +XPbusDevice::Write1(uint32 addr, uint32 data) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Read32(addr); + return d->Write1(addr, data); } busdata -XPbusDevice::Write8(uint32 addr, uint32 data) +XPbusDevice::Peek1(uint32 addr) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Write8(addr, data); -} - -busdata -XPbusDevice::Write16(uint32 addr, uint32 data) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Write16(addr, data); -} - -busdata -XPbusDevice::Write32(uint32 addr, uint32 data) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Write32(addr, data); -} - -busdata -XPbusDevice::Peek8(uint32 addr) -{ - addr &= 0x000fffff; - IODevice *d = SearchDevice(addr); - return d->Peek8(addr); + return d->Peek1(addr); } bool -XPbusDevice::Poke8(uint32 addr, uint32 data) +XPbusDevice::Poke1(uint32 addr, uint32 data) { addr &= 0x000fffff; IODevice *d = SearchDevice(addr); - return d->Poke8(addr, data); + return d->Poke1(addr, data); } // RMCR レジスタを取得する @@ -196,57 +161,30 @@ XPRAMDevice::~XPRAMDevice() } busdata -XPRAMDevice::Read8(uint32 addr) -{ - addr &= 0x1ff; - return ram[addr]; -} - -busdata -XPRAMDevice::Read16(uint32 addr) -{ - putlog(0, "should not be called?"); - return busdata::BusErr; -} - -busdata -XPRAMDevice::Read32(uint32 addr) +XPRAMDevice::Read1(uint32 addr) { - putlog(0, "should not be called?"); - return busdata::BusErr; + uint32 offset = addr & 0x1ff; + busdata data = ram[offset]; + return data; } busdata -XPRAMDevice::Write8(uint32 addr, uint32 data) +XPRAMDevice::Write1(uint32 addr, uint32 data) { - addr &= 0x1ff; - ram[addr] = data; + uint32 offset = addr & 0x1ff; + ram[offset] = data; return 0; } busdata -XPRAMDevice::Write16(uint32 addr, uint32 data) -{ - putlog(0, "should not be called?"); - return busdata::BusErr; -} - -busdata -XPRAMDevice::Write32(uint32 addr, uint32 data) -{ - putlog(0, "should not be called?"); - return busdata::BusErr; -} - -busdata -XPRAMDevice::Peek8(uint32 addr) +XPRAMDevice::Peek1(uint32 addr) { addr &= 0x1ff; return ram[addr]; } bool -XPRAMDevice::Poke8(uint32 addr, uint32 data) +XPRAMDevice::Poke1(uint32 addr, uint32 data) { if ((int32)data >= 0) { addr &= 0x1ff;