--- nono/vm/sio.cpp 2026/04/29 17:05:45 1.1.1.16 +++ 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); } @@ -77,6 +70,14 @@ SIODevice::Init() 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; } @@ -552,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(); } @@ -602,7 +604,7 @@ SIODevice::SetVIS() // モニター void -SIODevice::MonitorUpdate(Monitor *, TextScreen& screen) +SIODevice::MonitorScreen(Monitor *, TextScreen& screen) { uint cr2a; uint cr2b; @@ -617,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 @@ -646,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; @@ -749,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++; @@ -766,7 +768,7 @@ SIODevice::MonitorUpdateCh(TextScreen& s y++; // SR1 - MonitorUpdateSR1(screen, x, y, sr1); + MonitorScreenSR1(screen, x, y, sr1); y++; // 右列