--- nono/vm/adpcm.cpp 2026/04/29 17:05:24 1.1.1.3 +++ nono/vm/adpcm.cpp 2026/04/29 17:05:28 1.1.1.4 @@ -18,8 +18,6 @@ ADPCMDevice::ADPCMDevice() : inherited(OBJ_ADPCM) { - event.func = ToEventCallback(&ADPCMDevice::EventCallback); - event.Regist("ADPCM"); } // デストラクタ @@ -38,6 +36,10 @@ ADPCMDevice::Init() dmac = GetDMACDevice(); ppi = GetPPIDevice(); + event.func = ToEventCallback(&ADPCMDevice::EventCallback); + event.SetName("ADPCM"); + scheduler->RegistEvent(event); + return true; } @@ -54,7 +56,7 @@ ADPCMDevice::ResetHard(bool poweron) } busdata -ADPCMDevice::Read(uint32 offset) +ADPCMDevice::ReadPort(uint32 offset) { busdata data; @@ -71,18 +73,19 @@ ADPCMDevice::Read(uint32 offset) data = 0xff; break; default: - VMPANIC("corrupted offset=%d", offset); + VMPANIC("corrupted offset=%u", offset); } // InsideOut p.135 const busdata wait = busdata::Wait(18 * 40_nsec); data |= wait; + data |= BusData::Size1; return data; } busdata -ADPCMDevice::Write(uint32 offset, uint32 data) +ADPCMDevice::WritePort(uint32 offset, uint32 data) { switch (offset) { case 0: // CMD @@ -106,28 +109,37 @@ ADPCMDevice::Write(uint32 offset, uint32 } break; default: - VMPANIC("corrupted offset=%d", offset); + VMPANIC("corrupted offset=%u", offset); } // InsideOut p.135 const busdata wait = busdata::Wait(22 * 40_nsec); - return wait; + + busdata r = wait; + r |= BusData::Size1; + return r; } busdata -ADPCMDevice::Peek(uint32 offset) +ADPCMDevice::PeekPort(uint32 offset) { // XXX 未実装 return 0xff; } +bool +ADPCMDevice::PokePort(uint32 offset, uint32 data) +{ + return false; +} + // 再生開始 void ADPCMDevice::StartPlay() { // PPI で設定されているサンプリングレートをここで読み出す。 // XXX パンは未対応 - int rate = ppi->GetADPCMRate(); + uint rate = ppi->GetADPCMRate(); switch (rate) { case 0: div = 1024; @@ -140,7 +152,7 @@ ADPCMDevice::StartPlay() div = 512; break; default: - VMPANIC("corrupted ADPCM rate=%d", rate); + VMPANIC("corrupted ADPCM rate=%u", rate); } playing = true;