--- nono/vm/mk48t02.h 2026/04/29 17:04:39 1.1.1.4 +++ nono/vm/mk48t02.h 2026/04/29 17:04:55 1.1.1.9 @@ -8,6 +8,7 @@ #include "device.h" #include "mappedfile.h" +#include "monitor.h" #include "rtc.h" // MK48T02 の時計部分のレジスタと内部状態 @@ -54,12 +55,9 @@ class MK48T02Device : public RTCDevice using inherited = RTCDevice; public: MK48T02Device(); - ~MK48T02Device() override; + virtual ~MK48T02Device() override; bool Init() override; - bool InitRTC() override; - - void MonitorUpdate(TextScreen&) override; void ClockIn() override; @@ -67,12 +65,15 @@ class MK48T02Device : public RTCDevice std::string PeekString(uint32 addr) const; // 指定したアドレスに文字列を書き込む (内蔵 ROM からのアクセス用) bool WriteString(uint32 addr, const std::string& data); + // 全域をゼロクリアする (内蔵 ROM からのアクセス用) + void ClearAll(); // BusIO インタフェース // (内蔵 ROM からのアクセス用に特別に public にしてある) - uint64 Read(uint32 addr); - uint64 Write(uint32 addr, uint32 data); - uint64 Peek(uint32 addr); + uint64 Read(uint32 offset); + uint64 Write(uint32 offset, uint32 data); + uint64 Peek(uint32 offset); + protected: // BusIO インタフェース static const uint32 NPORT = 2048; @@ -85,6 +86,8 @@ class MK48T02Device : public RTCDevice // コントロールレジスタへの書き込み void WriteCtrl(uint32 data); + DECLARE_MONITOR_CALLBACK(MonitorUpdate); + // ファイル std::string filename {}; MappedFile file {}; @@ -96,5 +99,7 @@ class MK48T02Device : public RTCDevice // レジスタとして読める値を定数にすることで、仮想マシン状態を // 常に同じ状態にするためのパフォーマンス測定用フラグ。 // なお NVRAM 部分は影響されない。 - bool force_fixed = false; + bool force_fixed {}; + + Monitor monitor { this }; };