--- nono/vm/sio.h 2026/04/29 17:05:10 1.1.1.9 +++ nono/vm/sio.h 2026/04/29 17:05:59 1.1.1.13 @@ -10,35 +10,34 @@ #pragma once -#include "device.h" #include "mpscc.h" +class Keyboard; + class SIODevice : public MPSCCDevice { using inherited = MPSCCDevice; public: SIODevice(); - virtual ~SIODevice() override; + ~SIODevice() override; + bool Init() override; void ResetHard(bool poweron) override; // BusIO インタフェース // (内蔵 ROM からのアクセス用に特別に public にしてある) - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - + busdata ReadPort(uint32 offset); + busdata WritePort(uint32 offset, uint32 data); protected: - // BusIO インタフェース - static const uint32 NPORT = 4; - uint64 Peek(uint32 offset); + busdata PeekPort(uint32 offset); void Tx(int ch, uint32 data) override; uint GetHighestInt() const override; private: // 指定のレジスタ名を返す - const char *CRName(const MPSCCChan&, int n) const override; - const char *SRName(const MPSCCChan&, int n) const override; + const char *CRName(const MPSCCChan&, uint n) const override; + const char *SRName(const MPSCCChan&, uint n) const override; // 現在のレジスタ名を返す const char *CRName(const MPSCCChan& chan) const { return CRName(chan, chan.ptr); @@ -65,11 +64,15 @@ class SIODevice : public MPSCCDevice // VIS モードを更新 void SetVIS(); - DECLARE_MONITOR_CALLBACK(MonitorUpdate); - void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase); + DECLARE_MONITOR_SCREEN(MonitorScreen); + void MonitorScreenCh(TextScreen&, int ch, int xbase, int ybase); + + Keyboard *keyboard {}; static const char * const crnames[16]; static const char * const srnames[16]; }; -extern SIODevice *gSIO; +inline SIODevice *GetSIODevice() { + return Object::GetObject(OBJ_MPSCC); +}