--- nono/vm/romemu_x68k.cpp 2026/04/29 17:05:17 1.1.1.2 +++ nono/vm/romemu_x68k.cpp 2026/04/29 17:05:25 1.1.1.3 @@ -96,7 +96,7 @@ ROM30EmuDevice::Init() return true; } -uint64 +busdata ROM30EmuDevice::Read32(uint32 addr) { // IPLROM2 領域からのロングワードアクセスでだけ謎の I/O 空間が見える。 @@ -124,7 +124,7 @@ ROM30EmuDevice::SCSIBoot() const auto mainram = GetMainRAMDevice(); auto sram = GetSRAMDevice(); - auto mpu680x0 = dynamic_cast(mpu); + auto mpu680x0 = GetMPU680x0Device(mpu); m68kreg& reg = mpu680x0->reg; // SRAM の ROM 起動アドレスから SCSI ID を取得。 @@ -206,7 +206,7 @@ ROM30EmuDevice::SCSIBoot() const uint32 ROM30EmuDevice::SCSIIOCS() { - auto mpu680x0 = dynamic_cast(mpu); + auto mpu680x0 = GetMPU680x0Device(mpu); m68kreg& reg = mpu680x0->reg; uint32 scsicall = reg.D[1]; @@ -234,7 +234,7 @@ ROM30EmuDevice::SCSIIOCS() } #define PRE \ - auto mpu680x0 = dynamic_cast(mpu); \ + auto mpu680x0 = GetMPU680x0Device(mpu); \ m68kreg& reg = mpu680x0->reg; \ uint32 d4 = reg.D[4]; \ uint32 id = d4 & 0x0000ffff; \ @@ -262,9 +262,9 @@ ROM30EmuDevice::SCSI_S_INQUIRY(uint32 sc { PRE; - uint32 a1 = reg.A[1]; + busaddr a1(reg.A[1], busaddr::S); uint32 reqlen = reg.D[3]; - putlog(1, "%s a1=$%06x", loghdr.c_str(), a1); + putlog(1, "%s a1=$%06x", loghdr.c_str(), a1.Addr()); std::vector cmdseq(6); cmdseq[0] = SCSI::Command::Inquiry; cmdseq[1] = lun << 5; @@ -282,8 +282,8 @@ ROM30EmuDevice::SCSI_S_INQUIRY(uint32 sc // アロケーションサイズ(reqlen)と結果(cmd->buf)の小さい方まで転送 int len = std::min((int)reqlen, (int)res.size()); for (int i = 0; i < len; i++) { - int64 r = mainbus->Write8(a1++, res[i]); - if (r < 0) { + busdata bd = mainbus->Write8(a1++, res[i]); + if (bd.IsBusErr()) { return -1; } } @@ -295,7 +295,7 @@ ROM30EmuDevice::SCSI_S_READEXT(uint32 sc { PRE; - uint32 a1 = reg.A[1]; + busaddr a1(reg.A[1], busaddr::S); uint32 lba = reg.D[2]; uint32 blkcount = reg.D[3]; uint32 blkshift = reg.D[5]; @@ -304,7 +304,7 @@ ROM30EmuDevice::SCSI_S_READEXT(uint32 sc uint32 bytes = blkcount * blkbytes; putlog(1, "%s a1=$%06x lba=$%08x bytes=%d d5=%d", - loghdr.c_str(), a1, lba, bytes, blkshift); + loghdr.c_str(), a1.Addr(), lba, bytes, blkshift); std::vector cmdseq(10); cmdseq[0] = SCSI::Command::Read10; cmdseq[1] = lun << 5; @@ -337,8 +337,8 @@ ROM30EmuDevice::SCSI_S_READEXT(uint32 sc } for (int i = 0; i < bytes; i++) { - int64 r = mainbus->Write8(a1++, res[i]); - if (r < 0) { + busdata bd = mainbus->Write8(a1++, res[i]); + if (bd.IsBusErr()) { return -1; } } @@ -359,8 +359,8 @@ ROM30EmuDevice::SCSI_S_READCAP(uint32 sc { PRE; - uint32 a1 = reg.A[1]; - putlog(1, "%s a1=$%06x", loghdr.c_str(), a1); + busaddr a1(reg.A[1], busaddr::S); + putlog(1, "%s a1=$%06x", loghdr.c_str(), a1.Addr()); std::vector cmdseq(10); cmdseq[0] = SCSI::Command::ReadCapacity; cmdseq[1] = lun << 5; @@ -376,8 +376,8 @@ ROM30EmuDevice::SCSI_S_READCAP(uint32 sc const std::vector& res = cmd->buf; assert(res.size() == 8); for (auto data : res) { - int64 r = mainbus->Write8(a1++, data); - if (r < 0) { + busdata bd = mainbus->Write8(a1++, data); + if (bd.IsBusErr()) { return -1; } }