--- nono/vm/bankram.cpp 2026/04/29 17:05:43 1.1.1.5 +++ nono/vm/bankram.cpp 2026/04/29 17:06:01 1.1.1.7 @@ -13,6 +13,7 @@ #include "bankram.h" #include "config.h" +#include "mpu.h" // コンストラクタ BankRAMDevice::BankRAMDevice(uint objid_, int ram_size_MB) @@ -36,11 +37,12 @@ BankRAMDevice::Init() { ram.reset(new(std::nothrow) uint8[ram_size]); if ((bool)ram == false) { - errno = ENOMEM; - warn("BankRAM(%u bytes)", ram_size); + warnx("Could not allocate %u bytes at %s", ram_size, __method__); return false; } + wait = busdata::Wait(1 * mpu->GetClock_tsec()); + return true; } @@ -76,7 +78,7 @@ BankRAMDevice::Read(busaddr addr) data = *(uint32 *)&ram[offset & ~3U]; putlog(4, "$%06x ($%06x) -> $%08x", addr.Addr(), offset, data.Data()); - data |= busdata::Wait(1); + data |= wait; data |= BusData::Size4; return data; } @@ -107,7 +109,7 @@ BankRAMDevice::Write(busaddr addr, uint3 } } - busdata r = busdata::Wait(1); + busdata r = wait; r |= BusData::Size4; return r; }