--- nono/vm/opm.cpp 2026/04/29 17:05:16 1.1.1.6 +++ nono/vm/opm.cpp 2026/04/29 17:05:24 1.1.1.7 @@ -50,17 +50,16 @@ OPMDevice::ResetHard(bool poweron) fdc->SetForceReady(false); } -uint64 +busdata OPMDevice::Read(uint32 offset) { - uint8 data; - - mpu->AddCycle(19); // InsideOut p.135 + busdata data; switch (offset) { case 0: putlog(0, "Read $%06x (NOT IMPLEMENTED)", mpu->GetPaddr()); - return 0; + data = 0; + break; case 1: // OPM ステータスレジスタ data = 0; @@ -69,19 +68,24 @@ OPMDevice::Read(uint32 offset) } // タイマ関係の bit1, bit0 は未実装 - putlog(1, "STAT -> $%02x", data); - return data; + putlog(1, "STAT -> $%02x", data.Data()); + break; default: VMPANIC("corrupted offset=%d", offset); - return 0xff; + data = 0xff; + break; } + + // InsideOut p.135 + const busdata read_wait = busdata::Wait(19 * 40_usec); + data |= read_wait; + + return data; } -uint64 +busdata OPMDevice::Write(uint32 offset, uint32 data) { - mpu->AddCycle(53); // InsideOut p.135 - uint64 now = scheduler->GetVirtTime(); switch (offset) { @@ -136,10 +140,13 @@ OPMDevice::Write(uint32 offset, uint32 d break; } - return 0; + // InsideOut p.135 + const busdata write_wait = busdata::Wait(53 * 40_nsec); + + return write_wait; } -uint64 +busdata OPMDevice::Peek(uint32 offset) { // XXX 未実装