--- nono/vm/romemu_luna.h 2026/04/29 17:04:50 1.1.1.7 +++ nono/vm/romemu_luna.h 2026/04/29 17:04:55 1.1.1.9 @@ -23,6 +23,15 @@ class LunaPROMEmuDevice : public IODevic static const uint32 ROMIO_CLOSE = (ROMIO_BASE + 8); static const uint32 ROMIO_ENTRY = (ROMIO_BASE + 12); + // 文字コード + // 概ね ASCII だが制御コード部分は必要な文字だけを適当に割り当てる。 + static const char BS = 0x08; + static const char LF = 0x0a; + static const char UP = 0x1c; + static const char LEFT = 0x1d; + static const char RIGHT = 0x1e; + static const char DOWN = 0x1f; + // ブート情報格納用 struct bootinfo_t { int dkunit {}; @@ -49,19 +58,24 @@ class LunaPROMEmuDevice : public IODevic virtual uint32 ROM_Init() = 0; virtual uint32 ROM_Entry() = 0; virtual void ROM_Close(); + virtual void GetChar(char); virtual void Command() = 0; void InitDevice(); void InitScreen(const char *machine_name); + void ClearPrompt(); void ConsoleUpdate(); + + // NVRAM + uint8 CalcNVRAMCsum() const; + void WriteNVRAMCsum(); + bool VerifyNVRAM() const; + uint32 LoadHostFile(); uint32 LoadGuestFile(const bootinfo_t&); std::unique_ptr romdata {}; - // 内蔵 ROM 使用後はアクセスできないようにするため - bool is_closed {}; - // エラーメッセージの受け渡し用 // 基本的にエラーが起きた時だけ更新するので、ここにエラーメッセージを // 返す可能性がある関数をコールする前に呼び出し側が clear() しておき、 @@ -69,7 +83,7 @@ class LunaPROMEmuDevice : public IODevic std::string errmsg {}; // ROM モニタ用コンソール画面 - TextConsole text {}; + TextScreen text {}; // 入力バッファ std::string inputbuf {}; @@ -77,6 +91,12 @@ class LunaPROMEmuDevice : public IODevic // 現在のプロンプト文字列 std::string prompt {}; + // プロンプトのある行(最上行が 0) + int prompt_y {}; + + // カーソル位置(入力バッファ先頭が0) + int inputpos {}; + // NVRAM // 本来他デバイスはすべてグローバル参照できるのだが、LUNA の NVRAM は // RTC と兼用になっていて、RTCDevice *gRTC として見えるので @@ -86,10 +106,12 @@ class LunaPROMEmuDevice : public IODevic private: uint64 Decoder(uint32 addr) const; + // ROM->RAM 切り替え用フラグ。true なら ROM モード + bool isrom {}; + // キー入力 void ROM_Keyin(); - int inputpos {}; // カーソル位置 bool is_shift {}; // SHIFT キー押し下げ中 int mousecnt {}; // マウス入力をスキップするためのカウンタ