--- nono/vm/romemu_luna.cpp 2026/04/29 17:05:29 1.1.1.16 +++ nono/vm/romemu_luna.cpp 2026/04/29 17:05:51 1.1.1.19 @@ -42,7 +42,9 @@ #include "mpu.h" #include "pio.h" #include "prom.h" +#include "rtc.h" #include "scsidev.h" +#include "scsidomain.h" #include "sio.h" #include "spc.h" #include "ufs.h" @@ -64,10 +66,6 @@ LunaPROMEmuDevice::~LunaPROMEmuDevice() bool LunaPROMEmuDevice::Init() { - if (inherited::Init() == false) { - return false; - } - bt45x = GetBT45xDevice(); lance = GetLanceDevice(); lunafb = GetLunafbDevice(); @@ -124,6 +122,9 @@ LunaPROMEmuDevice::ReadROMIO(busaddr add case ROMIO_CLKCNT: return clkcnt; + case ROMIO_QUITSTOP: + return quitstop; + default: break; } @@ -143,6 +144,11 @@ LunaPROMEmuDevice::WriteROMIO(busaddr ad case ROMIO_CLKCNT: clkcnt = data; return true; + + case ROMIO_QUITSTOP: + quitstop = data; + return true; + default: break; } @@ -321,12 +327,17 @@ LunaPROMEmuDevice::Putc(uint ch) bold = false; break; - case 0x10: + case 0x10: // カラーコード変更 + lunafb->SetBMSEL(0); + break; case 0x11: + lunafb->SetBMSEL(1); + break; case 0x12: + lunafb->SetBMSEL(3); + break; case 0x13: - // カラーコード変更 - lunafb->SetBMSEL(ch - 0x10); + lunafb->SetBMSEL(5); break; case CR: @@ -433,6 +444,8 @@ LunaPROMEmuDevice::ROM_Close() // その時のためにエントリポイント等も初期化しておく。 entrypoint = -1; execute = false; + clkcnt = 0; + quitstop = 0; } // ROM プロンプトのキー入力。 @@ -654,7 +667,7 @@ LunaPROMEmuDevice::LoadHostFile() assert(gMainApp.exec_file); LoadInfo info(gMainApp.exec_file); - if (mainram->LoadExec(&info)) { + if (BootLoader::LoadExec(mainram, &info)) { return info.entry; } else { errmsg = "Couldn't load specified host program."; @@ -674,7 +687,7 @@ LunaPROMEmuDevice::LoadGuestFile(const b // ユニット (今は SCSI ID=6 決め打ち) uint id = 6; - SCSITarget *target = spc->GetSCSI()->GetTarget(id); + SCSITarget *target = spc->GetDomain()->GetTarget(id); if (target == NULL) { errmsg = "No bootable disks"; putmsg(0, "%s", errmsg.c_str()); @@ -748,7 +761,7 @@ LunaPROMEmuDevice::LoadGuestFile(const b std::string name = string_format("SCSIHD %u,%c:%s", id, dkpart + 'a', dkfile.c_str()); LoadInfo info(name.c_str(), f.data.data(), f.data.size()); - if (mainram->LoadExec(&info) == false) { + if (BootLoader::LoadExec(mainram, &info) == false) { errmsg = string_format("dk%u,%c,%s load failed", dkunit, dkpart + 'a', dkfile.c_str()); putmsg(0, "%s: %s", __func__, errmsg.c_str()); @@ -776,8 +789,16 @@ LunaPROMEmuDevice::ROM_AP1() static uint8 ap1pal[] = { 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, + 0, 0, 0, 0xf8, 0xf8, 0x00, + 0, 0, 0, 0xf8, 0xf8, 0xf8, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0x00, 0x00, 0x00, + 0xf8, 0xf8, 0xf8 }; bt45x->WritePort(0, 0); for (int i = 0; i < countof(ap1pal); i++) { @@ -793,12 +814,9 @@ LunaPROMEmuDevice::ROM_AP1() Print(std::string((const char *)test3)); n = strlcpy(buf, (const char *)&Builtin::IPLROM30[0x111e3], sizeof(buf)); - snprintf(buf + n, sizeof(buf) - n, "%d.%d.%d %s", - NONO_MAJOR_VER, NONO_MINOR_VER, NONO_PATCH_VER, NONO_DATE); - for (int i = 0; buf[i]; i++) { - if (buf[i] == '/') - buf[i] = '.'; - } + snprintf(buf + n, sizeof(buf) - n, "%d.%d.%d '%02d.%02d.%02d", + NONO_MAJOR_VER, NONO_MINOR_VER, NONO_PATCH_VER, + GetRTCDevice()->GetYear() % 100, 4, 1); Print("%s\n", buf); memcpy(buf, &Builtin::IPLROM30[0x111f5], 0x28); @@ -828,7 +846,7 @@ LunaPROMEmuDevice::ROM_AP1() strlcpy(buf, (const char *)&Builtin::IPLROM30[0x11280], sizeof(buf)); n = 0x1e; - n += snprintf(buf + n, sizeof(buf) - n, "%d", mainram->GetSizeMB()); + n += snprintf(buf + n, sizeof(buf) - n, "%u", mainram->GetSizeMB()); strlcpy(buf + n, (const char *)&Builtin::IPLROM30[0x1129f], sizeof(buf) - n); Print(std::string(buf));