--- nono/vm/adpcm.cpp 2026/04/29 17:05:16 1.1.1.2 +++ nono/vm/adpcm.cpp 2026/04/29 17:05:24 1.1.1.3 @@ -53,12 +53,10 @@ ADPCMDevice::ResetHard(bool poweron) div = 512; } -uint64 +busdata ADPCMDevice::Read(uint32 offset) { - uint8 data; - - mpu->AddCycle(18); // InsideOut p.135 + busdata data; switch (offset) { case 0: // STAT @@ -66,7 +64,7 @@ ADPCMDevice::Read(uint32 offset) if (playing) { data |= STAT_PLAY; } - putlog(1, "STAT -> $%02x", data); + putlog(1, "STAT -> $%02x", data.Data()); break; case 1: // DATA putlog(0, "Read $%06x (NOT IMPLEMENTED)", mpu->GetPaddr()); @@ -76,14 +74,16 @@ ADPCMDevice::Read(uint32 offset) VMPANIC("corrupted offset=%d", offset); } + // InsideOut p.135 + const busdata wait = busdata::Wait(18 * 40_nsec); + data |= wait; + return data; } -uint64 +busdata ADPCMDevice::Write(uint32 offset, uint32 data) { - mpu->AddCycle(22); // InsideOut p.135 - switch (offset) { case 0: // CMD putlog(1, "CMD <- $%02x", data); @@ -109,10 +109,12 @@ ADPCMDevice::Write(uint32 offset, uint32 VMPANIC("corrupted offset=%d", offset); } - return 0; + // InsideOut p.135 + const busdata wait = busdata::Wait(22 * 40_nsec); + return wait; } -uint64 +busdata ADPCMDevice::Peek(uint32 offset) { // XXX 未実装