--- nono/vm/dmac.cpp 2026/04/29 17:05:38 1.1.1.16 +++ nono/vm/dmac.cpp 2026/04/29 17:05:50 1.1.1.17 @@ -10,6 +10,7 @@ #include "dmac.h" #include "adpcm.h" +#include "event.h" #include "fdc.h" #include "interrupt.h" #include "mainbus.h" @@ -21,8 +22,8 @@ // time 時間後に呼び出すコールバックをセットする。 // func の書式が面倒なのを省略して書きたいため。 #define CallAfter(func_, time_, wait_) do { \ - event.func = ToEventCallback(&DMACDevice::func_); \ - event.time = time_ * 80_nsec + wait_; \ + event->func = ToEventCallback(&DMACDevice::func_); \ + event->time = time_ * 80_nsec + wait_; \ scheduler->StartEvent(event); \ } while (0) @@ -74,8 +75,8 @@ DMACDevice::Init() mainbus = GetMainbusDevice(); syncer = GetSyncer(); - event.SetName("DMAC"); - scheduler->RegistEvent(event); + auto evman = GetEventManager(); + event = evman->Regist(this, NULL, "DMAC"); return true; } @@ -123,7 +124,7 @@ DMACDevice::ResetHard(bool poweron) ChangeInterrupt(); // イベントを停止 - event.SetName("DMAC"); + event->SetName("DMAC"); scheduler->StopEvent(event); } @@ -874,7 +875,7 @@ DMACDevice::MonitorReg4(TextScreen& scre if (names[i][0] == '-') { screen.Puts(x + i * 4, y, TA::Disable, "---"); } else { - bool b = reg & (1 << (3 - i)); + bool b = reg & (1U << (3 - i)); screen.Puts(x + i * 4, y, TA::OnOff(b), names[i]); } } @@ -1147,7 +1148,7 @@ DMACDevice::StartTransfer(DMACChan *chan putlogn("#%u Start %s mtc=$%04x", chan->ch, msg.c_str(), chan->mtc); } - if (event.IsRunning() == false) { + if (event->IsRunning() == false) { CallAfter(StartCallback, 0, 0); } } @@ -1174,18 +1175,18 @@ DMACDevice::SelectChannel() } if (ch == -1) { // 転送チャンネルはもうないのでイベントは停止したままにする - event.SetName("DMAC"); + event->SetName("DMAC"); return NULL; } else { chan = &channel[ch]; - event.SetName(string_format("DMAC #%u", chan->ch)); + event->SetName(string_format("DMAC #%u", chan->ch)); return chan; } } // 転送開始 void -DMACDevice::StartCallback(Event& ev) +DMACDevice::StartCallback(Event *ev) { // チャンネルを決定 auto chan = SelectChannel(); @@ -1283,7 +1284,7 @@ DMACDevice::StartCallback(Event& ev) // 転送処理 void -DMACDevice::TransferCallback(Event& ev) +DMACDevice::TransferCallback(Event *ev) { // チャンネルを決定 auto chan = SelectChannel(); @@ -1535,7 +1536,7 @@ DMACDevice::TransferError(DMACChan *chan } // 現在のイベントを再実行 - event.time = 1 * 80_nsec; + event->time = 1 * 80_nsec; scheduler->StartEvent(event); return; } else { @@ -1715,7 +1716,7 @@ DMACDevice::AssertREQ(uint ch) chan->pcl_pin = true; } - if (event.IsRunning() == false) { + if (event->IsRunning() == false) { scheduler->StartEvent(event); } }