--- nono/vm/mpscc.cpp 2026/04/29 17:05:50 1.1.1.11 +++ nono/vm/mpscc.cpp 2026/04/29 17:06:00 1.1.1.12 @@ -753,21 +753,21 @@ MPSCCDevice::Rx(int ch, uint32 data) } static double -to_freq(uint64 nsec) +tsec_to_freq(uint64 tsec) { - return (double)1.0 / nsec * 1e9; + return (double)1_sec / tsec; } // ボーレートを再計算する。 -// CR4(ClkRate) と xc12_ns の変更で呼ぶこと。 +// CR4(ClkRate) と xc12_tsec の変更で呼ぶこと。 void MPSCCDevice::ChangeBaudrate(MPSCCChan& chan) { double old_baudrate = chan.baudrate; // 誤差を減らすため 12bit 分の時間を基準とする。 - chan.bit12_ns = chan.xc12_ns * chan.clkrate; - chan.baudrate = (double)to_freq(chan.bit12_ns) * 12; + chan.bit12_tsec = chan.xc12_tsec * chan.clkrate; + chan.baudrate = tsec_to_freq(chan.bit12_tsec) * 12; if (loglevel >= 3) { if (chan.baudrate != old_baudrate) { @@ -838,7 +838,7 @@ MPSCCDevice::SetRxPeriod(MPSCCChan& chan bit += AdditionalBits(chan, chan.rx_enable); chan.rxframebits = bit; - rxevent[chan.id]->time = bit * chan.bit12_ns / 12; + rxevent[chan.id]->time = bit * chan.bit12_tsec / 12; if (loglevel >= 1) { bool old_enable = chan.old_cr3 & MPSCC::CR3_RX_EN; @@ -859,7 +859,7 @@ MPSCCDevice::SetRxPeriod(MPSCCChan& chan // そうでなければ(有効→有効なら)、パラメータが変化すれば表示。 std::string nsstr; if (loglevel >= 2) { - nsstr = string_format(" (%" PRIu64 ")", chan.bit12_ns); + nsstr = string_format(" (%" PRIu64 ")", chan.bit12_tsec); } putlogn("Channel %c RX Enable, %.1f bps%s, %u bits/frame", chan.name, @@ -870,7 +870,7 @@ MPSCCDevice::SetRxPeriod(MPSCCChan& chan } } - // パフォーマンス測定用のギミック。 + // --perf によるパフォーマンス測定用のギミック。 // シリアルポートを特定の設定 (本体 5bit、ストップビット 2bit) にすると、 // VM 電源オン時から現在までの実時間をログに出力する。NetBSD/OpenBSD の // マルチユーザブートがあらかた終わってログインプロンプトが出る手前の @@ -903,7 +903,7 @@ MPSCCDevice::SetTxPeriod(MPSCCChan& chan bit += AdditionalBits(chan, chan.tx_enable); chan.txframebits = bit; - txevent[chan.id]->time = bit * chan.bit12_ns / 12; + txevent[chan.id]->time = bit * chan.bit12_tsec / 12; if (loglevel >= 1) { bool old_enable = chan.old_cr5 & MPSCC::CR5_TX_EN; @@ -924,7 +924,7 @@ MPSCCDevice::SetTxPeriod(MPSCCChan& chan // そうでなければ(有効→有効なら)、パラメータが変化すれば表示。 std::string nsstr; if (loglevel >= 2) { - nsstr = string_format(" (%" PRIu64 ")", chan.bit12_ns); + nsstr = string_format(" (%" PRIu64 ")", chan.bit12_tsec); } putlogn("Channel %c TX Enable, %.1f bps%s, %u bits/frame", chan.name, @@ -1103,7 +1103,7 @@ MPSCCDevice::GetParamStr(const MPSCCChan // モニタに CR3/WR3、CR4/WR4、CR5/WR5 の内容を書き出す。 // 更新後の y を返す。 int -MPSCCDevice::MonitorUpdateCR345(TextScreen& screen, int x, int y, +MPSCCDevice::MonitorScreenCR345(TextScreen& screen, int x, int y, uint8 cr3, uint8 cr4, uint8 cr5) { const std::array bits_per_char { '5', '7', '6', '8' }; @@ -1158,7 +1158,7 @@ MPSCCDevice::MonitorUpdateCR345(TextScre // モニタに SR1/RR1 の内容を書き出す。 void -MPSCCDevice::MonitorUpdateSR1(TextScreen& screen, int x, int y, uint8 sr1) +MPSCCDevice::MonitorScreenSR1(TextScreen& screen, int x, int y, uint8 sr1) { static const char * const sr1_str[] = { "EOF", "FrEr", "RxOv", "PaEr", "", "", "", "Sent" @@ -1167,7 +1167,7 @@ MPSCCDevice::MonitorUpdateSR1(TextScreen screen.Print(x + 29, y, TA::Disable, "ResidueCode=%d", (sr1 >> 1) & 7); } -// レジスタをビットごとに表示する。MonitorUpdate の下請け。 +// レジスタをビットごとに表示する。MonitorScreen の下請け。 void MPSCCDevice::MonitorReg(TextScreen& screen, int x, int y, uint32 reg, const char * const *names)