--- nono/vm/romemu_luna.h 2026/04/29 17:05:50 1.1.1.16 +++ nono/vm/romemu_luna.h 2026/04/29 17:06:00 1.1.1.17 @@ -11,6 +11,7 @@ #pragma once #include "romemu.h" +#include "fixedqueue.h" class BT45xDevice; class LanceDevice; @@ -32,7 +33,7 @@ class LunaPROMEmuDevice : public ROMEmuD static const uint32 ROMIO_BASE = 0x41010000; static const uint32 ROMIO_INIT = (ROMIO_BASE + 0x00); static const uint32 ROMIO_LOAD = (ROMIO_BASE + 0x04); - static const uint32 ROMIO_KEYIN = (ROMIO_BASE + 0x08); + static const uint32 ROMIO_SIOINTR = (ROMIO_BASE + 0x08); static const uint32 ROMIO_CLOSE = (ROMIO_BASE + 0x0c); static const uint32 ROMIO_ENTRY = (ROMIO_BASE + 0x10); static const uint32 ROMIO_AP1 = (ROMIO_BASE + 0x14); @@ -86,6 +87,7 @@ class LunaPROMEmuDevice : public ROMEmuD void Putc(uint ch); void Print(const std::string& s); void Print(const char *fmt, ...) __printflike(2, 3); + void PrintDisplay(const char *s); // NVRAM virtual bool InitNVRAM() = 0; @@ -106,6 +108,9 @@ class LunaPROMEmuDevice : public ROMEmuD // LUNA-88K では 'b'/'bh' コマンドで。 bool execute {}; + // シリアルか。(DIP-SW で決まる) + bool use_serial {}; + // 機種名 (タイトル表示用) const char *machine_name {}; @@ -148,12 +153,18 @@ class LunaPROMEmuDevice : public ROMEmuD SPCDevice *spc {}; private: - // キー入力 - void ROM_Keyin(); + void ROM_SIOIntr(); + void PutcSerial(uint); + void PutcDisplay(uint); + void ProcessSerial(); + int GetcSerial(); + int GetcKeyboard(); bool is_shift {}; // SHIFT キー押し下げ中 int mousecnt {}; // マウス入力をスキップするためのカウンタ + FixedQueue sio_txq; // シリアル送信キュー + uint32 clkcnt {}; // クロック割り込みカウンタ // luna88k で割り込みからジャンプして戻る時のアドレス。