--- nono/vm/device.cpp 2026/04/29 17:05:29 1.1.1.11 +++ nono/vm/device.cpp 2026/04/29 17:06:01 1.1.1.14 @@ -34,16 +34,20 @@ Device::Create() } bool -Device::Init() +Device::Create2() +{ + return true; +} + +void +Device::EarlyInit() { mpu = GetMPUDevice(); scheduler = GetScheduler(); - - return true; } bool -Device::Apply() +Device::Init() { return true; } @@ -69,11 +73,8 @@ Device::putlogn(const char *fmt, ...) co int len; vt = scheduler->GetVirtTime(); - len = snprintf(buf, sizeof(buf), "%4u.%03u'%03u'%03u %08x %s ", - (uint)(vt / 1000 / 1000 / 1000), - (uint)((vt / 1000 / 1000) % 1000), - (uint)((vt / 1000) % 1000), - (uint)(vt % 1000), + len = snprintf(buf, sizeof(buf), "%16s %08x %s ", + SecToStr(vt).c_str(), mpu->GetPPC(), GetName().c_str()); @@ -100,17 +101,6 @@ IODevice::~IODevice() { } -// 初期化 -bool -IODevice::Init() -{ - if (inherited::Init() == false) { - return false; - } - - return true; -} - busdata IODevice::Read(busaddr addr) { @@ -158,109 +148,3 @@ IODevice::Poke1(uint32 addr, uint32 data { return false; } - - -// -// バスエラー -// - -// コンストラクタ -BusErrDevice::BusErrDevice() - : inherited(OBJ_BUSERR) -{ - ClearAlias(); - AddAlias("BusErr"); -} - -// デストラクタ -BusErrDevice::~BusErrDevice() -{ -} - -busdata -BusErrDevice::Read(busaddr addr) -{ - uint32 datasize = addr.GetSize(); - - putlog(1, "$%08x.%u", addr.Addr(), datasize); - busdata data = BusData::BusErr; - data |= busdata::Size(datasize); - return data; -} - -busdata -BusErrDevice::Write(busaddr addr, uint32 data) -{ - uint32 datasize = addr.GetSize(); - - putlog(1, "$%08x.%u <- %0*X", addr.Addr(), datasize, datasize * 2, data); - busdata r = BusData::BusErr; - r |= busdata::Size(datasize); - return r; -} - -busdata -BusErrDevice::Peek1(uint32 addr) -{ - return BusData::BusErr; -} - - -// -// 何もしないデバイス -// - -// コンストラクタ -NopIODevice::NopIODevice() - : inherited(OBJ_NOPIO) -{ - ClearAlias(); - AddAlias("NopIO"); -} - -// デストラクタ -NopIODevice::~NopIODevice() -{ -} - -busdata -NopIODevice::Read(busaddr addr) -{ - uint32 datasize = addr.GetSize(); - - putlog(1, "$%08x.%u", addr.Addr(), datasize); - busdata data = (1ULL << (datasize * 8)) - 1; - data |= busdata::Size(datasize); - return data; -} - -busdata -NopIODevice::Write(busaddr addr, uint32 data) -{ - uint32 datasize = addr.GetSize(); - - putlog(1, "$%08x.%u <- $%0*x", addr.Addr(), datasize, datasize * 2, data); - busdata r = busdata::Size(datasize); - return r; -} - -busdata -NopIODevice::Peek1(uint32 addr) -{ - return 0xff; -} - -busdata -NopIODevice::Read1(uint32 addr) -{ - putlog(1, "XP $%05x", addr); - busdata data = 0xff; - return data; -} - -busdata -NopIODevice::Write1(uint32 addr, uint32 data) -{ - putlog(1, "XP $%05x <- $%02x", addr, data); - return 0; -}