--- nono/vm/mpu.cpp 2026/04/29 17:05:32 1.1.1.14 +++ nono/vm/mpu.cpp 2026/04/29 17:05:41 1.1.1.16 @@ -48,10 +48,6 @@ MPUDevice::~MPUDevice() bool MPUDevice::Init() { - if (inherited::Init() == false) { - return false; - } - debugger = GetDebugger(); // パラメータは継承側でセットしている。 @@ -134,6 +130,23 @@ MainMPUDevice::TraceMessage(MessageID ms SetTrace((bool)arg); } +void +MainMPUDevice::ChangeState(uint32 new_state) +{ + // new_mode (CPU_STATE_*) と + // RequestCPUMode() の引数 Syncer::SYNCMODE_CPU_* は + // 実は同じ値なのでそのまま渡してよいことにする。 + static_assert(CPU_STATE_NORMAL == Syncer::SYNCMODE_CPU_NORMAL, ""); + static_assert(CPU_STATE_STOP == Syncer::SYNCMODE_CPU_STOP, ""); + static_assert(CPU_STATE_HALT == Syncer::SYNCMODE_CPU_HALT, ""); + + if (cpu_state != new_state) { + cpu_state = new_state; + // スケジューラに通知 + syncer->RequestCPUMode(cpu_state); + } +} + // Round Mode (モニタ表示用) /*static*/ const char * const MainMPUDevice::rmstr[4] = {