--- nono/vm/sio.h 2026/04/29 17:05:10 1.1.1.9 +++ nono/vm/sio.h 2026/04/29 17:05:24 1.1.1.11 @@ -10,27 +10,29 @@ #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 Read(uint32 offset); + busdata Write(uint32 offset, uint32 data); protected: // BusIO インタフェース static const uint32 NPORT = 4; - uint64 Peek(uint32 offset); + busdata Peek(uint32 offset); void Tx(int ch, uint32 data) override; uint GetHighestInt() const override; @@ -68,8 +70,12 @@ class SIODevice : public MPSCCDevice DECLARE_MONITOR_CALLBACK(MonitorUpdate); void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase); + Keyboard *keyboard {}; + static const char * const crnames[16]; static const char * const srnames[16]; }; -extern SIODevice *gSIO; +static inline SIODevice *GetSIODevice() { + return Object::GetObject(OBJ_MPSCC); +}