--- nono/vm/newsctlr.cpp 2026/04/29 17:05:21 1.1.1.2 +++ nono/vm/newsctlr.cpp 2026/04/29 17:05:25 1.1.1.3 @@ -94,6 +94,7 @@ NewsCtlrDevice::ResetHard(bool poweron) // たぶん止まるだろう。知らんけど。 timer_intr = false; timer_enable = false; + ChangeInterrupt(); // たぶん消すだろう。知らんけど。 led = 0; @@ -104,39 +105,36 @@ NewsCtlrDevice::ResetHard(bool poweron) } } -uint64 +busdata NewsCtlrDevice::Read8(uint32 addr) { - uint64 data = -1; - addr |= 0xc0000000; if ((addr >> 16) == 0xe1c0) { uint idx = (addr >> 8) & 3; + uint32 data; switch (idx) { case 0: // e1c0'00xx data = GetIDROM(addr); - putlog(2, "$%08x.B (IDROM) -> $%02x", addr, (uint32)data); + putlog(2, "$%08x.B (IDROM) -> $%02x", addr, data); break; case 2: // e1c0'02xx // 割り込みステータス data = interrupt->PeekStatus(); - putlog(1, "$%08x.B (IntStat) -> $%02x", addr, (uint32)data); + putlog(1, "$%08x.B (IntStat) -> $%02x", addr, data); break; default: // e1c0'01xx // DIP-SW data = GetDIPSW(); - putlog(1, "$%08x.B (DIPSW) -> $%02x", addr, (uint32)data); + putlog(1, "$%08x.B (DIPSW) -> $%02x", addr, data); break; } return data; } - VMPANIC("Read8($%08x)", addr); - return data; } -uint64 +busdata NewsCtlrDevice::Write8(uint32 addr, uint32 data) { addr |= 0xc0000000; @@ -191,10 +189,9 @@ NewsCtlrDevice::Write8(uint32 addr, uint } VMPANIC("Write8($%08x) <- $%02x", addr, data); - return (uint64)-1; } -uint64 +busdata NewsCtlrDevice::Peek8(uint32 addr) { addr |= 0xc0000000; @@ -211,7 +208,47 @@ NewsCtlrDevice::Peek8(uint32 addr) } } - return (uint64)-1; + return busdata::BusErr; +} + +// NewsIO の下請けとして呼ばれる。 +void +NewsCtlrDevice::MonitorUpdateNewsCtlr(TextScreen& screen, int y) +{ + // テーブル方式ではないので、Read/Write と手動で揃える…。 + + uint32 addr = 0xe100; + for (int i = 0; i < 32; i++) { + screen.Print(0, y, "$%04x'0000:", addr); + + const char *name = NULL; + TA attr; + for (int j = 0; j < 8; j++) { + switch (addr) { + case 0xe100: name = "Timer"; break; + case 0xe108: name = "ParEn?"; break; + case 0xe118: name = "Lv2Int?"; break; + case 0xe128: name = "ASTDis?"; break; + case 0xe130: name = "L2CE?"; break; + case 0xe138: name = "Power"; break; + case 0xe190: name = "L2CD?"; break; + case 0xe1a0: name = "ParDis?"; break; + case 0xe1c0: name = "Misc"; break; + default: + name = NULL; + break; + } + if (name) { + attr = TA::Normal; + } else { + name = "NopIO"; + attr = TA::Disable; + } + screen.Puts(12 + j * 8, y, attr, name); + addr++; + } + y++; + } } // IDROM の値を返す。この関数は副作用を起こしてはいけない。