--- nono/vm/scc.cpp 2026/04/29 17:05:28 1.1.1.14 +++ nono/vm/scc.cpp 2026/04/29 17:05:59 1.1.1.18 @@ -10,6 +10,7 @@ #include "scc.h" #include "bitops.h" +#include "event.h" #include "hostcom.h" #include "keyboard.h" @@ -40,7 +41,7 @@ SCCDevice::SCCDevice() mpscc.chan[0].dataaddr = 0xe98007; // 5MHz - pclk_ns = 200_nsec; + pclk_tsec = 200_nsec; } else { // NWS-1750 mpscc.chan[0].desc = "Serial Port #0"; @@ -52,20 +53,12 @@ SCCDevice::SCCDevice() // たぶん 4MHz // http://www.ceres.dti.ne.jp/~tsutsui/netbsd/port-news68k.html#19990727 - pclk_ns = 250_nsec; + pclk_tsec = 250_nsec; } - // X680x0 では SCC と呼ぶほうが通りがいい。 - // イベントの登録は親クラスで行ってある。 - for (int ch = 0; ch < txevent.size(); ch++) { - auto& chan = mpscc.chan[ch]; - txevent[ch].SetName(string_format("SCC Ch%c TX", chan.name)); - rxevent[ch].SetName(string_format("SCC Ch%c RX", chan.name)); - } - - monitor.func = ToMonitorCallback(&SCCDevice::MonitorUpdate); - monitor.SetSize(70, 35); - monitor.Regist(ID_MONITOR_SCC); + monitor = gMonitorManager->Regist(ID_MONITOR_SCC, this); + monitor->SetCallback(&SCCDevice::MonitorScreen); + monitor->SetSize(70, 35); } // デストラクタ @@ -81,10 +74,20 @@ SCCDevice::Init() return false; } + hostcom->SetPortName("SCC Ch.A"); + if (gMainApp.IsX68030()) { keyboard = GetKeyboard(); } + // X680x0 では SCC と呼ぶほうが通りがいい。 + // イベントの登録は親クラスで行ってある。 + for (int ch = 0; ch < txevent.size(); ch++) { + auto& chan = mpscc.chan[ch]; + txevent[ch]->SetName(string_format("SCC Ch%c TX", chan.name)); + rxevent[ch]->SetName(string_format("SCC Ch%c RX", chan.name)); + } + return true; } @@ -746,7 +749,7 @@ SCCDevice::WriteWR15(MPSCCChan& chan, ui // モニター void -SCCDevice::MonitorUpdate(Monitor *, TextScreen& screen) +SCCDevice::MonitorScreen(Monitor *, TextScreen& screen) { uint wr9; uint rr3a; @@ -759,7 +762,7 @@ SCCDevice::MonitorUpdate(Monitor *, Text for (int i = 0; i < 2; i++) { int x = 0; y = i * 16; - MonitorUpdateCh(screen, i, x, y); + MonitorScreenCh(screen, i, x, y); } y = 32; @@ -794,7 +797,7 @@ SCCDevice::MonitorUpdate(Monitor *, Text // モニター (1チャンネル) void -SCCDevice::MonitorUpdateCh(TextScreen& screen, int ch, int xbase, int ybase) +SCCDevice::MonitorScreenCh(TextScreen& screen, int ch, int xbase, int ybase) { const MPSCCChan& chan = mpscc.chan[ch]; uint crc; @@ -908,7 +911,7 @@ SCCDevice::MonitorUpdateCh(TextScreen& s y++; // WR3,WR4,WR5 - y = MonitorUpdateCR345(screen, x, y, wr3, wr4, wr5); + y = MonitorScreenCR345(screen, x, y, wr3, wr4, wr5); // WR10 screen.Puts(x + 9, y, TA::Disable, (wr10 & 0x80) ? "CRC1" : "CRC0"); @@ -986,7 +989,7 @@ SCCDevice::MonitorUpdateCh(TextScreen& s y++; // RR1 - MonitorUpdateSR1(screen, x, y, rr1); + MonitorScreenSR1(screen, x, y, rr1); y++; // RR10 @@ -1018,7 +1021,7 @@ SCCDevice::MonitorUpdateCh(TextScreen& s void SCCDevice::SetXC(MPSCCChan& chan) { - chan.xc12_ns = (2 * (chan.tc + 2)) * pclk_ns * 12; + chan.xc12_tsec = (2 * (chan.tc + 2)) * pclk_tsec * 12; ChangeBaudrate(chan); }