--- nono/vm/sysport.h 2026/04/29 17:04:45 1.1.1.5 +++ nono/vm/sysport.h 2026/04/29 17:05:14 1.1.1.10 @@ -4,6 +4,10 @@ // Licensed under nono-license.txt // +// +// システムポート +// + #pragma once #include "device.h" @@ -22,28 +26,36 @@ struct SYSPORT int contrast; int rom_wait; // 設定値。ウェイトにする時には +2 する int ram_wait; // 設定値。 + bool key_ctrl; + uint pwoff_count; }; -class SysportDevice - : public IODevice +class SysportDevice : public IODevice { using inherited = IODevice; - private: + static const uint32 baseaddr = 0xe8e000; public: SysportDevice(); virtual ~SysportDevice() override; - void ResetHard() override; + void ResetHard(bool poweron) override; + + // KEYCTRL の状態を取得する + bool GetKeyCtrl() const { + return sysport.key_ctrl; + } protected: // BusIO インタフェース static const uint32 NPORT = 8; - 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); private: struct SYSPORT sysport {}; }; + +extern SysportDevice *gSysport;