--- nono/vm/lcd.h 2026/04/29 17:04:58 1.1.1.8 +++ nono/vm/lcd.h 2026/04/29 17:05:29 1.1.1.12 @@ -4,6 +4,10 @@ // Licensed under nono-license.txt // +// +// LCD (HD44780) +// + #pragma once #include "device.h" @@ -14,10 +18,10 @@ class LCDDevice : public Device using inherited = Device; public: LCDDevice(); - virtual ~LCDDevice() override; + ~LCDDevice() override; - bool PowerOff() override; - void ResetHard() override; + void ResetHard(bool poweron) override; + void PowerOff() override; // リセット信号はない @@ -49,7 +53,7 @@ class LCDDevice : public Device const uint8 *GetDDRAM() const { return ddram; } // フォントを取得 - const uint8 *GetFont(int ch) const; + const uint8 *GetFont(uint ch) const; private: DECLARE_MONITOR_CALLBACK(MonitorUpdate); @@ -57,7 +61,7 @@ class LCDDevice : public Device // 現在のアドレスでデータレジスタにラッチ void LatchData(); // アドレスカウンタ設定 - void SetAddr(int addr, bool is_cgram); + void SetAddr(uint addr, bool is_cgram); // アドレスカウンタを次へ進める void NextAddr(); @@ -73,7 +77,7 @@ class LCDDevice : public Device uint8 data_reg {}; // アドレスカウンタ - int addr_counter {}; + uint addr_counter {}; bool addr_is_cgram {}; // addr が CGRAM アドレスなら true uint8 ddram[0x80] {}; @@ -84,4 +88,6 @@ class LCDDevice : public Device static const uint8 CGROM[12 * 16 * 8]; }; -extern std::unique_ptr gLCD; +static inline LCDDevice *GetLCDDevice() { + return Object::GetObject(OBJ_LCD); +}