--- nono/vm/videoctlr.h 2026/04/29 17:04:39 1.1.1.2 +++ nono/vm/videoctlr.h 2026/04/29 17:05:10 1.1.1.7 @@ -4,15 +4,19 @@ // Licensed under nono-license.txt // +// +// ビデオコントローラ +// + #pragma once #include "device.h" +#include "color.h" -class VideoCtlrDevice - : public IODevice +class VideoCtlrDevice : public IODevice { using inherited = IODevice; - private: + static const int baseaddr = 0xe82000; struct videoctlr { @@ -23,18 +27,20 @@ class VideoCtlrDevice public: VideoCtlrDevice(); - ~VideoCtlrDevice() override; + virtual ~VideoCtlrDevice() override; + + void ResetHard(bool poweron) override; // 加工済みテキストパレットの先頭アドレスを取得 // レンダラとかからの参照用 - const uint32 *GetCookedPalette() const { return cooked_palette; } + const ColorXBGR *GetHostPalette() const { return cooked_palette; } protected: // BusIO インタフェース static const uint NPORT = 4096; - 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: void SetR0(uint32 data); @@ -48,8 +54,8 @@ class VideoCtlrDevice uint16 w[512]; } palette {}; - // xBGR32 形式のテキストパレット (レンダラ用に加工したもの) - uint32 cooked_palette[16]; + // ホスト形式のテキストパレット (レンダラ用に加工したもの) + ColorXBGR cooked_palette[16] {}; }; -extern std::unique_ptr gVideoCtlr; +extern VideoCtlrDevice *gVideoCtlr;