--- nono/vm/lunafb.cpp 2026/04/29 17:05:28 1.1.1.6 +++ nono/vm/lunafb.cpp 2026/04/29 17:05:42 1.1.1.9 @@ -41,6 +41,7 @@ #include "bt45x.h" #include "builtinrom.h" #include "busio.h" +#include "monitor.h" #include "mpu.h" // コンストラクタ @@ -51,9 +52,9 @@ LunafbDevice::LunafbDevice() ClearAlias(); AddAlias("Lunafb"); - monitor.func = ToMonitorCallback(&LunafbDevice::MonitorUpdate); - monitor.SetSize(39, 11); - monitor.Regist(ID_MONITOR_LUNAVC); + monitor = gMonitorManager->Regist(ID_MONITOR_LUNAVC, this); + monitor->func = ToMonitorCallback(&LunafbDevice::MonitorUpdate); + monitor->SetSize(39, 11); } // デストラクタ @@ -76,7 +77,12 @@ LunafbDevice::Init() fcset_end = fcset0base + 0x40000 * nplane; // プレーン数によってメモリを確保 - mem.reset(new uint8 [0x40000 * nplane]); + size_t memsize = 0x40000 * nplane; + mem.reset(new(std::nothrow) uint8 [memsize]); + if ((bool)mem == false) { + warnx("Cannot allocate %zu bytes at %s", memsize, __method__); + return false; + } // ホストパレットを取得。 palette = &(bt45x->GetHostPalette())[0]; @@ -299,7 +305,7 @@ LunafbDevice::MonitorUpdate(Monitor *, T // Plane#0 Sel THRU $ffffffff screen.Print(0, 0, "RFCNT: $%08x (X=%4ddot, Y=%4ddot)", rfcnt, xscroll, yscroll); - screen.Print(3, 2, "BMSEL=$%02x ROP Mask", bmsel); + screen.Print(2, 2, "BMSEL=$%02x ROP Mask", bmsel); for (i = 0; i < nplane; i++) { screen.Print(0, 3 + i, "Plane#%u %s %s $%08x", @@ -332,7 +338,7 @@ LunafbDevice::SetDirty(uint32 offset) // 更新フラグはラスタ単位 uint y = (offset >> 8); - dirty[y] = 1; + dirty.line[y] = true; } // X 方向にはみ出したときに対応する仮想画面の Y 座標を返す。