--- nono/vm/romemu_luna.h 2026/04/29 17:04:59 1.1.1.10 +++ nono/vm/romemu_luna.h 2026/04/29 17:05:10 1.1.1.12 @@ -4,6 +4,10 @@ // Licensed under nono-license.txt // +// +// LUNA シリーズの ROM エミュレーション共通部分 +// + #pragma once #include "rom.h" @@ -55,9 +59,12 @@ class LunaPROMEmuDevice : public ROMDevi virtual void Command() = 0; void InitDevice(); - void InitScreen(const char *machine_name); + void InitScreen(); + void PrintTitle(const char *machine_name); void ClearPrompt(); - void ConsoleUpdate(); + void Putc(uint ch); + void Print(const std::string& s); + void Print(const char *fmt, ...) __printflike(2, 3); // NVRAM uint8 CalcNVRAMCsum() const; @@ -73,21 +80,28 @@ class LunaPROMEmuDevice : public ROMDevi // 関数から戻ったら empty() かどうか確認する、errno みたいな使い方。 std::string errmsg {}; - // ROM モニタ用コンソール画面 - TextScreen text {}; - // 入力バッファ std::string inputbuf {}; // 現在のプロンプト文字列 std::string prompt {}; + // デフォルトプロンプト。 + const std::string default_prompt = ">"; + // プロンプトのある行(最上行が 0) int prompt_y {}; // カーソル位置(入力バッファ先頭が0) int inputpos {}; + int screen_w {}; // テキスト桁数 + int screen_h {}; // テキスト行数 + int cursor_x {}; // カーソル位置(桁) + int cursor_y {}; // カーソル位置(行) + int origin_px {}; // テキスト画面の左上 X 座標(ピクセル) + int origin_py {}; // テキスト画面の左上 Y 座標(ピクセル) + // NVRAM // 本来他デバイスはすべてグローバル参照できるのだが、LUNA の NVRAM は // RTC と兼用になっていて、RTCDevice *gRTC として見えるので