--- nono/vm/rp5c15.cpp 2026/04/29 17:05:25 1.1.1.14 +++ nono/vm/rp5c15.cpp 2026/04/29 17:05:29 1.1.1.15 @@ -12,7 +12,6 @@ #include "rp5c15.h" #include "mfp.h" -#include "mpu.h" #include "power.h" // コンストラクタ @@ -54,14 +53,13 @@ RP5C15Device::Init() } busdata -RP5C15Device::Read(uint32 offset) +RP5C15Device::ReadPort(uint32 offset) { busdata data; - int n; // バンクを展開する - int bank = (reg.mode & RP5C15::MODE_BANK); - n = bank * 0x10 + offset; + uint bank = (reg.mode & RP5C15::MODE_BANK); + uint n = bank * 0x10 + offset; // XXX 14, 15 は write only らしいが何が読めるか @@ -82,25 +80,24 @@ RP5C15Device::Read(uint32 offset) // 下位4ビット(RP5C15) の中の未実装ビットは %0 だが // 上位4ビットは %1 になる。 data |= 0xf0; - putlog(2, "Bank%d $%x -> $%02x", bank, offset, data.Data()); + putlog(2, "Bank%u $%x -> $%02x", bank, offset, data.Data()); // InsideOut p.135 const busdata read_wait = busdata::Wait(29 * 40_nsec); data |= read_wait; + data |= BusData::Size1; return data; } busdata -RP5C15Device::Write(uint32 offset, uint32 data) +RP5C15Device::WritePort(uint32 offset, uint32 data) { - int n; - // バンクを展開する - int bank = (reg.mode & RP5C15::MODE_BANK); - n = bank * 0x10 + offset; + uint bank = (reg.mode & RP5C15::MODE_BANK); + uint n = bank * 0x10 + offset; - putlog(2, "Bank%d $%x <- $%x", bank, offset, (data & 0x0f)); + putlog(2, "Bank%u $%x <- $%x", bank, offset, (data & 0x0f)); switch (n) { case RP5C15::SEC1: @@ -231,11 +228,13 @@ RP5C15Device::Write(uint32 offset, uint3 // InsideOut p.135 const busdata write_wait = busdata::Wait(38 * 40_nsec); - return write_wait; + busdata r = write_wait; + r |= BusData::Size1; + return r; } busdata -RP5C15Device::Peek(uint32 offset) +RP5C15Device::PeekPort(uint32 offset) { int n; @@ -259,6 +258,12 @@ RP5C15Device::Peek(uint32 offset) } } +bool +RP5C15Device::PokePort(uint32 offset, uint32 data) +{ + return false; +} + void RP5C15Device::MonitorUpdate(Monitor *, TextScreen& screen) { @@ -267,8 +272,8 @@ RP5C15Device::MonitorUpdate(Monitor *, T screen.Clear(); - int year = reg.year10 * 10 + reg.year1 + year_epoch; - int hour10; + uint year = reg.year10 * 10 + reg.year1 + year_epoch; + uint hour10; const char *ampm; if (reg.sel24) { ampm = ""; @@ -277,14 +282,14 @@ RP5C15Device::MonitorUpdate(Monitor *, T ampm = (reg.hour10 & 2) == 0 ? " AM": " PM"; hour10 = reg.hour10 & 1; } - screen.Print(0, y++, "%04d[%x%x]/%x%x/%x%x(%s) %x%x:%x%x:%x%x.%02x%s", + screen.Print(0, y++, "%04u[%x%x]/%x%x/%x%x(%s) %x%x:%x%x:%x%x.%02x%s", year, reg.year10, reg.year1, reg.mon10, reg.mon1, reg.day10, reg.day1, wdays[reg.wday], hour10, reg.hour1, reg.min10, reg.min1, reg.sec10, reg.sec1, ((uint32)cnt & 0x1f), ampm); screen.Print(0, y, "TimeZone: %s", (use_localtime) ? "Local" : "UTC"); - screen.Print(x, y, "Epoch: %4d", year_epoch); + screen.Print(x, y, "Epoch: %4u", year_epoch); // バンク0 y = 3; @@ -353,14 +358,14 @@ RP5C15Device::MonitorUpdate(Monitor *, T screen.Print(x + 14, 4, "(%s)", clksel_s[reg.clksel]); // 12/24H - screen.Print(x + 14, 14, "(%dH)", reg.sel24 ? 24 : 12); + screen.Print(x + 14, 14, "(%uH)", reg.sel24 ? 24 : 12); // MODE y = 17; screen.Print(0, y, "$d(MODE): %x", reg.mode); screen.Puts(14, y, TA::OnOff(reg.mode & RP5C15::MODE_TIMER_EN), "TIMER_EN"); screen.Puts(23, y, TA::OnOff(reg.mode & RP5C15::MODE_ALARM_EN), "ALARM_EN"); - screen.Print(32, y, "BANK=%d", reg.mode & RP5C15::MODE_BANK); + screen.Print(32, y, "BANK=%u", reg.mode & RP5C15::MODE_BANK); // TEST y++; @@ -421,7 +426,7 @@ RP5C15Device::GetHour() const if (reg.sel24) { return reg.hour10 * 10 + reg.hour1; } else { - int h10; + uint h10; h10 = (reg.hour10 & 0x1) * 10 + ((reg.hour10 & 0x2) >> 1) * 12; return h10 + reg.hour1; } @@ -435,7 +440,7 @@ RP5C15Device::SetHour(uint v) reg.hour1 = v % 10; reg.hour10 = v / 10; } else { - int pm = (v < 12) ? 0x0 : 0x2; + uint pm = (v < 12) ? 0x0 : 0x2; v %= 12; reg.hour1 = v % 10; reg.hour10 = v / 10 + pm;