--- nono/vm/sio.cpp 2026/04/29 17:05:24 1.1.1.12 +++ nono/vm/sio.cpp 2026/04/29 17:05:28 1.1.1.13 @@ -136,7 +136,7 @@ SIODevice::ResetChannel(MPSCCChan& chan) } busdata -SIODevice::Read(uint32 offset) +SIODevice::ReadPort(uint32 offset) { busdata data; @@ -154,14 +154,15 @@ SIODevice::Read(uint32 offset) data = ReadCtrl(mpscc.chan[1]); break; default: - VMPANIC("corrupted offset=%d", offset); + VMPANIC("corrupted offset=%u", offset); } // XXX wait? + data |= BusData::Size1; return data; } busdata -SIODevice::Write(uint32 offset, uint32 data) +SIODevice::WritePort(uint32 offset, uint32 data) { switch (offset) { case 0: @@ -177,14 +178,15 @@ SIODevice::Write(uint32 offset, uint32 d WriteCtrl(mpscc.chan[1], data); break; default: - VMPANIC("corrupted offset=%d", offset); + VMPANIC("corrupted offset=%u", offset); } // XXX wait? - return 0; + busdata r = BusData::Size1; + return r; } busdata -SIODevice::Peek(uint32 offset) +SIODevice::PeekPort(uint32 offset) { uint64 data; @@ -210,20 +212,20 @@ SIODevice::Peek(uint32 offset) // 書き込みレジスタ名を返す const char * -SIODevice::CRName(const MPSCCChan& chan, int ptr_) const +SIODevice::CRName(const MPSCCChan& chan, uint ptr_) const { assert(ptr_ < 8); - int idx = ptr_ * 2 + chan.id; + uint idx = ptr_ * 2 + chan.id; assert(idx < countof(crnames)); return crnames[idx]; } // 読み込みレジスタ名を返す const char * -SIODevice::SRName(const MPSCCChan& chan, int ptr_) const +SIODevice::SRName(const MPSCCChan& chan, uint ptr_) const { assert(ptr_ < 8); - int idx = ptr_ * 2 + chan.id; + uint idx = ptr_ * 2 + chan.id; assert(idx < countof(srnames)); return srnames[idx]; } @@ -350,7 +352,7 @@ SIODevice::WriteCtrl(MPSCCChan& chan, ui WriteCR7(chan, data); break; default: - VMPANIC("corrupted chan.ptr=%d", chan.ptr); + VMPANIC("corrupted chan.ptr=%u", chan.ptr); } // アクセス後は CR0 へ戻す chan.ptr = 0; @@ -468,13 +470,13 @@ SIODevice::WriteCR0(MPSCCChan& chan, uin chan.ptr = data & MPSCC::CR0_PTR; if (chan.crc_cmd != 0) { - putlog(0, "%s crc_cmd %d (NOT IMPLEMENTED)", + putlog(0, "%s crc_cmd %u (NOT IMPLEMENTED)", CRName(chan, 0), chan.crc_cmd); } if (chan.cmd == 0) { // コマンド0 ならレジスタ切り替え - putlog(3, "%s <- $%02x (ptr=%d)", CRName(chan, 0), data, chan.ptr); + putlog(3, "%s <- $%02x (ptr=%u)", CRName(chan, 0), data, chan.ptr); } else { // 0 以外ならコマンド発行 putlog(2, "%s <- $%02x", CRName(chan, 0), data); @@ -512,7 +514,7 @@ SIODevice::WriteCR0(MPSCCChan& chan, uin } break; default: - VMPANIC("corrupted chan.cmd=%d", chan.cmd); + VMPANIC("corrupted chan.cmd=%u", chan.cmd); } } @@ -633,7 +635,7 @@ SIODevice::MonitorUpdate(Monitor *, Text } screen.Print(34, y, TA::OnOff((cr2a & MPSCC::CR2_PRIOSEL)), "PRIO"); // bit1,0 はよく分からん - screen.Print(39, y, "INT/DMA=%d", (cr2a & MPSCC::CR2_INTDMA)); + screen.Print(39, y, "INT/DMA=%u", (cr2a & MPSCC::CR2_INTDMA)); y++; // CR2B @@ -688,7 +690,7 @@ SIODevice::MonitorUpdateCh(TextScreen& s screen.Print(x, y++, "CR7/CR6: $%02x%02x", cr7, cr6); screen.Print(x, y++, "SR0: $%02x", sr0); screen.Print(x, y++, "SR1: $%02x", sr1); - screen.Print(x, y, "RXbuf: %d", rxlen); + screen.Print(x, y, "RXbuf: %u", rxlen); int i; for (i = 0; i < rxlen; i++) { screen.Print(x + 9 + i * 4, y, "$%02x", chan.rxbuf[i]); @@ -706,7 +708,7 @@ SIODevice::MonitorUpdateCh(TextScreen& s y = ybase + 1; x = xbase; // CR0 - screen.Print(x + 9, y, "CRC=%d", (cr0 >> 6)); + screen.Print(x + 9, y, "CRC=%u", (cr0 >> 6)); static const char * const cmd_str[] = { // 0123456789012345 "No operation", @@ -719,8 +721,8 @@ SIODevice::MonitorUpdateCh(TextScreen& s "End of Interrupt", }; uint cmd = (cr0 >> 3) & 7; - screen.Print(x + 19, y, "CMD=%d(%s)", cmd, cmd_str[cmd]); - screen.Print(x + 43, y, "PTR=%d", (cr0 & 7)); + screen.Print(x + 19, y, "CMD=%u(%s)", cmd, cmd_str[cmd]); + screen.Print(x + 43, y, "PTR=%u", (cr0 & 7)); y++; // CR1 @@ -772,8 +774,8 @@ SIODevice::MonitorUpdateCh(TextScreen& s screen.Print(x, y++, "CtrlAddr: $%08x", chan.ctrladdr); y++; screen.Print(x, y++, "Param:%13s", GetParamStr(chan).c_str()); - screen.Print(x, y++, "Rx Bits/Frame: %2d", chan.rxframebits); - screen.Print(x, y++, "Tx Bits/Frame: %2d", chan.txframebits); + screen.Print(x, y++, "Rx Bits/Frame: %2u", chan.rxframebits); + screen.Print(x, y++, "Tx Bits/Frame: %2u", chan.txframebits); } // ペンディングのうち最も優先度の高い割り込み要因を返す @@ -827,7 +829,7 @@ SIODevice::Tx(int ch, uint32 data) keyboard->Command(data); break; default: - VMPANIC("corrupted ch=%d", ch); + VMPANIC("corrupted ch=%u", ch); } }