--- nono/vm/rp5c15.cpp 2026/04/29 17:05:14 1.1.1.11 +++ nono/vm/rp5c15.cpp 2026/04/29 17:05:17 1.1.1.12 @@ -17,11 +17,8 @@ // コンストラクタ RP5C15Device::RP5C15Device() - : inherited("RTC") + : inherited() { - devaddr = 0xe8a000; - devlen = 0x2000; - // X68k の RTC epoch は 1980年固定で変更の必要はないので、設定も見ない。 year_epoch = 1980; // X68k は通常ローカルタイム (というか JST) で使用する前提 @@ -41,12 +38,19 @@ RP5C15Device::~RP5C15Device() bool RP5C15Device::Init() { + if (inherited::Init() == false) { + return false; + } + + mfp = GetMFPDevice(); + power = GetPowerDevice(); + // デフォルトで 24 時間計にしておく reg.sel24 = 0x01; // デフォルトで 1HZ_ON, 16HZ_ON をネゲート(1)しておく reg.reset = RP5C15::RESET_1Hz | RP5C15::RESET_16Hz; - return inherited::Init(); + return true; } uint64 @@ -55,7 +59,7 @@ RP5C15Device::Read(uint32 offset) uint8 data; int n; - gMPU->AddCycle(29); // InsideOut p.135 + mpu->AddCycle(29); // InsideOut p.135 // バンクを展開する int bank = (reg.mode & RP5C15::MODE_BANK); @@ -74,7 +78,7 @@ RP5C15Device::Read(uint32 offset) data = reg.r[n]; break; default: - __unreachable(); + VMPANIC("corrupted n=$%x", n); } // 下位4ビット(RP5C15) の中の未実装ビットは %0 だが @@ -90,7 +94,7 @@ RP5C15Device::Write(uint32 offset, uint3 { int n; - gMPU->AddCycle(38); // InsideOut p.135 + mpu->AddCycle(38); // InsideOut p.135 // バンクを展開する int bank = (reg.mode & RP5C15::MODE_BANK); @@ -247,7 +251,7 @@ RP5C15Device::Peek(uint32 offset) return reg.r[n] | 0xf0; default: - __unreachable(); + return 0xff; } } @@ -519,8 +523,8 @@ RP5C15Device::ChangeAlarmOut() alarm_out = alarm_16Hz | alarm_1Hz | alarm_on; if (old != alarm_out) { - gPower->SetAlarmOut(alarm_out); - gMFP->SetAlarmOut(alarm_out); + power->SetAlarmOut(alarm_out); + mfp->SetAlarmOut(alarm_out); } }