--- nono/vm/rp5c15.cpp 2026/04/29 17:04:36 1.1.1.3 +++ nono/vm/rp5c15.cpp 2026/04/29 17:04:50 1.1.1.6 @@ -5,6 +5,7 @@ // #include "rp5c15.h" +#include "mpu.h" #include // アラームは未実装 @@ -17,7 +18,7 @@ RP5C15Device::RP5C15Device() devname = "RTC"; devaddr = 0xe8a000; devlen = 0x2000; - monitor.Init(30, 17); + monitor_size = nnSize(30, 17); } RP5C15Device::~RP5C15Device() @@ -38,13 +39,15 @@ RP5C15Device::InitRTC() } uint64 -RP5C15Device::Read(uint32 addr) +RP5C15Device::Read(uint32 offset) { uint8 data; int n; + gMPU->AddCycle(29); // InsideOut p.135 + // バンクを展開する - n = bank * 0x10 + addr; + n = bank * 0x10 + offset; // XXX 14, 15 は write only らしいが何が読めるか @@ -65,20 +68,22 @@ RP5C15Device::Read(uint32 addr) // 下位4ビット(RP5C15) の中の未実装ビットは %0 だが // 上位4ビットは %1 になる。 data |= 0xf0; - putlog(2, "RTC Bank%d $%x -> $%02x", bank, addr, data); + putlog(2, "RTC Bank%d $%x -> $%02x", bank, offset, data); return data; } uint64 -RP5C15Device::Write(uint32 addr, uint32 data) +RP5C15Device::Write(uint32 offset, uint32 data) { int n; + gMPU->AddCycle(38); // InsideOut p.135 + // バンクを展開する - n = bank * 0x10 + addr; + n = bank * 0x10 + offset; - putlog(2, "RTC Bank%d $%x <- $%x", bank, addr, (data & 0x0f)); + putlog(2, "RTC Bank%d $%x <- $%x", bank, offset, (data & 0x0f)); switch (n) { case RP5C15::SEC1: @@ -220,12 +225,12 @@ RP5C15Device::Write(uint32 addr, uint32 } uint64 -RP5C15Device::Peek(uint32 addr) +RP5C15Device::Peek(uint32 offset) { int n; // バンクを展開する - n = bank * 0x10 + addr; + n = bank * 0x10 + offset; switch (n) { case RP5C15::MODE_BANK1: @@ -243,8 +248,8 @@ RP5C15Device::Peek(uint32 addr) } } -bool -RP5C15Device::MonitorUpdate() +void +RP5C15Device::MonitorUpdate(TextScreen& monitor) { int x; int y; @@ -298,8 +303,6 @@ RP5C15Device::MonitorUpdate() y++; monitor.Print(x, y++, "cnt %2d", rtc.cnt); - - return true; } // 32Hz クロック入力