--- nono/vm/crtc2.cpp 2026/04/29 17:04:50 1.1.1.6 +++ nono/vm/crtc2.cpp 2026/04/29 17:05:10 1.1.1.8 @@ -4,28 +4,36 @@ // Licensed under nono-license.txt // +// +// CRTC-II (HD6445) +// + #include "crtc2.h" #include "renderer.h" +#include "scheduler.h" -std::unique_ptr gCRTC2; +// グローバル参照用 +CRTC2Device *gCRTC2; +// コンストラクタ CRTC2Device::CRTC2Device() + : inherited("CRTC2") { - logname = "crtc2"; - devname = "CRTC2"; devaddr = 0xd1000000; - vdisp_event.dev = this; - vdisp_event.func = (DeviceCallback_t)&CRTC2Device::VDispCallback; - vdisp_event.SetName("CRTC2 V-DISP"); + vdisp_event.func = ToEventCallback(&CRTC2Device::VDispCallback); + vdisp_event.Regist("CRTC2 V-DISP"); } +// デストラクタ CRTC2Device::~CRTC2Device() { + gCRTC2 = NULL; } +// リセット void -CRTC2Device::ResetHard() +CRTC2Device::ResetHard(bool poweron) { // リセット信号で初期化されるレジスタ (他は維持) reg[30] = 0; @@ -39,7 +47,7 @@ CRTC2Device::ResetHard() // すぐに垂直帰線期間を開始する vdisp_event.time = 0; vdisp_event.code = 1; - vdisp_event.Start(); + gScheduler->RestartEvent(vdisp_event); } uint64 @@ -157,5 +165,5 @@ CRTC2Device::VDispCallback(Event& ev) ev.time = 507.328_usec; // 32*Ht ev.code = 1; } - ev.Start(); + gScheduler->StartEvent(ev); }