--- nono/vm/upd7201.cpp 2026/04/29 17:04:36 1.1.1.3 +++ nono/vm/upd7201.cpp 2026/04/29 17:04:39 1.1.1.4 @@ -9,7 +9,7 @@ // コンストラクタ uPD7201Device::uPD7201Device() { - monitor.Init(48, 19); + monitor_size = nnSize(48, 19); cr.chan[0].id = 0; cr.chan[0].name = "A"; cr.chan[1].id = 1; @@ -429,21 +429,21 @@ uPD7201Device::Rx(int ch, uint32 data) } // モニター -bool -uPD7201Device::MonitorUpdate() +void +uPD7201Device::MonitorUpdate(TextScreen& monitor) { monitor.Clear(); for (int i = 0; i < 2; i++) { int x = 0; int y = i * 10; - MonitorUpdateCh(i, x, y); + MonitorUpdateCh(monitor, i, x, y); } - return true; } // モニター (1チャンネル) void -uPD7201Device::MonitorUpdateCh(int ch, int xbase, int ybase) +uPD7201Device::MonitorUpdateCh(TextScreen& monitor, + int ch, int xbase, int ybase) { struct SIO::channel *chan = &cr.chan[ch]; uint cr0; @@ -515,7 +515,7 @@ uPD7201Device::MonitorUpdateCh(int ch, i static const char * const cr1_str[] = { "WaEn", "----", "WaRx", "", "", "----", "TxIE", "ESEn" }; - MonitorReg(x + 9, y, cr1, cr1_str); + MonitorReg(monitor, x + 9, y, cr1, cr1_str); monitor.Print(x + 24, y, "RXInt=%d", (cr1 >> 3) & 3); y++; @@ -523,7 +523,7 @@ uPD7201Device::MonitorUpdateCh(int ch, i static const char * const cr3_str[] = { "", "", "AuEn", "----", "----", "----", "----", "RXEn" }; - MonitorReg(x + 9, y, cr3, cr3_str); + MonitorReg(monitor, x + 9, y, cr3, cr3_str); monitor.Print(x + 9, y, "RXbits=%d", 5 + ((cr3 >> 6) & 3)); y++; @@ -531,7 +531,7 @@ uPD7201Device::MonitorUpdateCh(int ch, i static const char * const cr4_str[] = { "", "", "", "", "", "", "PaEv", "PaEn" }; - MonitorReg(x + 9, y, cr4, cr4_str); + MonitorReg(monitor, x + 9, y, cr4, cr4_str); static const char * const clkrate_str[] = { "1", "16", "32", "64" @@ -551,7 +551,7 @@ uPD7201Device::MonitorUpdateCh(int ch, i static const char * const cr5_str[] = { "DTR", "", "", "SBrk", "TXEn", "CRC", "!RTS", "TCEn" }; - MonitorReg(x + 9, y, cr5, cr5_str); + MonitorReg(monitor, x + 9, y, cr5, cr5_str); monitor.Print(x + 14, y, "TXbits=%d", 5 + ((cr5 >> 5) & 3)); y++; @@ -559,21 +559,22 @@ uPD7201Device::MonitorUpdateCh(int ch, i static const char * const sr0_str[] = { "BrAb", "TxUn", "CTS", "SYNC", "DCD", "TxEm", "IntP", "RxAv" }; - MonitorReg(x + 9, y, sr0, sr0_str); + MonitorReg(monitor, x + 9, y, sr0, sr0_str); y++; // SR1 static const char * const sr1_str[] = { "EOF", "CRCE", "RxOv", "PaEr", "", "", "", "Sent" }; - MonitorReg(x + 9, y, sr1, sr1_str); + MonitorReg(monitor, x + 9, y, sr1, sr1_str); monitor.Print(x + 29, y, "ResidueCode=%d", (sr1 >> 1) & 7); y++; } // レジスタをビットごとに表示する。MonitorUpdate の下請け。 void -uPD7201Device::MonitorReg(int x, int y, uint32 reg, const char * const *names) +uPD7201Device::MonitorReg(TextScreen& monitor, + int x, int y, uint32 reg, const char * const *names) { for (int i = 0; i < 8; i++) { if (strcmp(names[i], "----") == 0) {