--- nono/vm/scc.h 2026/04/29 17:05:09 1.1.1.9 +++ nono/vm/scc.h 2026/04/29 17:05:24 1.1.1.11 @@ -10,30 +10,30 @@ #pragma once -#include "device.h" #include "mpscc.h" +class Keyboard; + class SCCDevice : public MPSCCDevice { using inherited = MPSCCDevice; - static const int baseaddr = 0xe98000; - public: SCCDevice(); - virtual ~SCCDevice() override; + ~SCCDevice() override; + bool Init() override; void ResetHard(bool poweron) override; // 割り込みアクノリッジ - int InterruptAcknowledge(); + busdata InterruptAcknowledge(); protected: // BusIO インタフェース static const uint32 NPORT = 4; - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - uint64 Peek(uint32 offset); + busdata Read(uint32 offset); + busdata Write(uint32 offset, uint32 data); + busdata Peek(uint32 offset); void Tx(int ch, uint32 data) override; uint GetHighestInt() const override; @@ -86,8 +86,15 @@ class SCCDevice : public MPSCCDevice DECLARE_MONITOR_CALLBACK(MonitorUpdate); void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase); + // PCLK (入力クロック) の時間表現 + uint64 pclk_ns {}; + + Keyboard *keyboard {}; + static const char * const wrnames[32]; static const char * const rrnames[32]; }; -extern SCCDevice *gSCC; +static inline SCCDevice *GetSCCDevice() { + return Object::GetObject(OBJ_MPSCC); +}