--- nono/vm/newsctlr.h 2026/04/29 17:05:25 1.1.1.3 +++ nono/vm/newsctlr.h 2026/04/29 17:05:50 1.1.1.6 @@ -11,17 +11,19 @@ #pragma once #include "device.h" -#include "event.h" -#include "textscreen.h" #include class DipswDevice; class NewsInterrupt; +class TextScreen; class NewsCtlrDevice : public IODevice { using inherited = IODevice; + // システムタイマーの周期 + static const uint64 TIMER_PERIOD = 10_msec; + public: // LED 種別 static const uint LED_GREEN = 0x01; @@ -34,9 +36,9 @@ class NewsCtlrDevice : public IODevice bool Init() override; void ResetHard(bool poweron) override; - busdata Read8(uint32 addr) override; - busdata Write8(uint32 addr, uint32 data) override; - busdata Peek8(uint32 addr) override; + busdata Read(busaddr addr) override; + busdata Write(busaddr addr, uint32 data) override; + busdata Peek1(uint32 addr) override; uint GetLED() const { return led; } @@ -47,7 +49,7 @@ class NewsCtlrDevice : public IODevice uint8 GetDIPSW() const; void WriteLED(uint32 data); void WriteTimer(uint32 data); - void TimerCallback(Event&); + void TimerCallback(Event *); void ChangeInterrupt(); // 割り込みコントローラ @@ -61,9 +63,15 @@ class NewsCtlrDevice : public IODevice bool timer_intr {}; bool timer_enable {}; + // システムタイマーが刻んている時刻。 + uint64 stime {}; + + // システムタイマーを実時間に同期する場合 true + bool sync_rt {}; + DipswDevice *dipsw {}; - Event timer_event { this }; + Event *timer_event {}; }; static inline NewsCtlrDevice *GetNewsCtlrDevice() {