--- nono/vm/sio.cpp 2026/04/29 17:05:32 1.1.1.14 +++ nono/vm/sio.cpp 2026/04/29 17:05:59 1.1.1.18 @@ -10,6 +10,7 @@ #define MPSCC_SIO_LOG_HACK #include "sio.h" +#include "event.h" #include "hostcom.h" #include "keyboard.h" #include "mainapp.h" @@ -44,19 +45,11 @@ SIODevice::SIODevice() // 153.6kHz = 6.510416...usec / bit; // 12bit = 78.125usec - mpscc.chan[0].xc12_ns = 78.125_usec; - mpscc.chan[1].xc12_ns = 78.125_usec; - - // LUNA では SIO と呼ぶほうが通りがいい。 - // イベントの登録は親クラスで行ってある。 - for (int ch = 0; ch < txevent.size(); ch++) { - auto& chan = mpscc.chan[ch]; - txevent[ch].SetName(string_format("SIO Ch%c TX", chan.name)); - rxevent[ch].SetName(string_format("SIO Ch%c RX", chan.name)); - } + mpscc.chan[0].xc12_tsec = 78.125_usec; + mpscc.chan[1].xc12_tsec = 78.125_usec; monitor = gMonitorManager->Regist(ID_MONITOR_SIO, this); - monitor->func = ToMonitorCallback(&SIODevice::MonitorUpdate); + monitor->SetCallback(&SIODevice::MonitorScreen); monitor->SetSize(70, 24); } @@ -73,8 +66,18 @@ SIODevice::Init() return false; } + hostcom->SetPortName("SIO Ch.A"); + keyboard = GetKeyboard(); + // LUNA では SIO と呼ぶほうが通りがいい。 + // イベントの登録は親クラスで行ってある。 + for (int ch = 0; ch < txevent.size(); ch++) { + auto& chan = mpscc.chan[ch]; + txevent[ch]->SetName(string_format("SIO Ch%c TX", chan.name)); + rxevent[ch]->SetName(string_format("SIO Ch%c RX", chan.name)); + } + return true; } @@ -550,6 +553,7 @@ SIODevice::WriteCR1(MPSCCChan& chan, uin chan.rxint_mode = MPSCCChan::RXINT_ALLCHAR; chan.sp_parity = true; chan.all_or_first = true; + break; default: __unreachable(); } @@ -600,7 +604,7 @@ SIODevice::SetVIS() // モニター void -SIODevice::MonitorUpdate(Monitor *, TextScreen& screen) +SIODevice::MonitorScreen(Monitor *, TextScreen& screen) { uint cr2a; uint cr2b; @@ -615,7 +619,7 @@ SIODevice::MonitorUpdate(Monitor *, Text for (int i = 0; i < 2; i++) { int x = 0; y = i * 11; - MonitorUpdateCh(screen, i, x, y); + MonitorScreenCh(screen, i, x, y); } // CR2A @@ -644,7 +648,7 @@ SIODevice::MonitorUpdate(Monitor *, Text // モニター (1チャンネル) void -SIODevice::MonitorUpdateCh(TextScreen& screen, int ch, int xbase, int ybase) +SIODevice::MonitorScreenCh(TextScreen& screen, int ch, int xbase, int ybase) { const MPSCCChan& chan = mpscc.chan[ch]; uint cr0; @@ -747,7 +751,7 @@ SIODevice::MonitorUpdateCh(TextScreen& s y++; // CR3,CR4,CR5 - y = MonitorUpdateCR345(screen, x, y, cr3, cr4, cr5); + y = MonitorScreenCR345(screen, x, y, cr3, cr4, cr5); // CR6,CR7 y++; @@ -764,7 +768,7 @@ SIODevice::MonitorUpdateCh(TextScreen& s y++; // SR1 - MonitorUpdateSR1(screen, x, y, sr1); + MonitorScreenSR1(screen, x, y, sr1); y++; // 右列 @@ -803,7 +807,6 @@ SIODevice::GetHighestInt() const if ((mpscc.chan[1].intpend & INTPEND_TX)) return MPSCC::VS_TxB; if ((mpscc.chan[0].intpend & INTPEND_ES)) return MPSCC::VS_ESA; if ((mpscc.chan[1].intpend & INTPEND_ES)) return MPSCC::VS_ESB; - } else { if ((mpscc.chan[0].intpend & INTPEND_SP)) return MPSCC::VS_SPA; if ((mpscc.chan[0].intpend & INTPEND_RX)) return MPSCC::VS_RxA;