--- nono/vm/goldfish_rtc.h 2026/04/29 17:05:24 1.1.1.1 +++ nono/vm/goldfish_rtc.h 2026/04/29 17:05:59 1.1.1.4 @@ -18,14 +18,14 @@ class TextScreen; class GFRTC { public: - static const uint TIME_LOW = 0x00; - static const uint TIME_HIGH = 0x04; - static const uint ALARM_LOW = 0x08; - static const uint ALARM_HIGH = 0x0c; - static const uint INTR_STATUS = 0x10; - static const uint ALARM_CLEAR = 0x14; - static const uint ALARM_STATUS = 0x18; - static const uint INTR_CLEAR = 0x1c; + static const uint TIME_LOW = 0x00U >> 2; + static const uint TIME_HIGH = 0x04U >> 2; + static const uint ALARM_LOW = 0x08U >> 2; + static const uint ALARM_HIGH = 0x0cU >> 2; + static const uint INTR_STATUS = 0x10U >> 2; + static const uint ALARM_CLEAR = 0x14U >> 2; + static const uint ALARM_STATUS = 0x18U >> 2; + static const uint INTR_CLEAR = 0x1cU >> 2; }; class GFRTCDevice : public RTCDevice @@ -36,15 +36,17 @@ class GFRTCDevice : public RTCDevice GFRTCDevice(); ~GFRTCDevice() override; - bool Init() override; void ResetHard(bool poweron) override; - busdata Read32(uint32 addr) override; - busdata Write32(uint32 addr, uint32 data) override; - busdata Peek8(uint32 addr) override; - // モニタの下請け。(GFTimer から呼ばれる) - int MonitorUpdateRTC(TextScreen&, int y) const; + int MonitorScreenRTC(TextScreen&, int y) const; + + protected: + // BusIO インタフェース + static const uint32 NPORT = 0x1000 >> 2; + busdata ReadPort(uint32 offset); + busdata WritePort(uint32 offset, uint32 data); + busdata PeekPort(uint32 offset); private: void Tick1Hz() override; @@ -77,6 +79,6 @@ class GFRTCDevice : public RTCDevice uint min; uint sec; - // TIME レジスタラッチ - uint64 time_nsec {}; + // TIME レジスタラッチ。Goldfish 仕様により 1[nsec] 単位。 + union64 time_nsec {}; };