--- nono/vm/pio.cpp 2026/04/29 17:04:32 1.1 +++ nono/vm/pio.cpp 2026/04/29 17:04:36 1.1.1.2 @@ -1,13 +1,14 @@ // // nono -// Copyright (C) 2017 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #include "pio.h" +#include "config.h" #include "lcd.h" #include "mystring.h" #include "scheduler.h" -#include "config.h" // IODevice // | @@ -181,6 +182,8 @@ PIO0Device::PIO0Device() devname = "PIO0"; devaddr = 0x49000000; devlen = 4; + + monitor.Init(22, 11); } // デストラクタ @@ -193,14 +196,14 @@ PIO0Device::Init() { // XXX 本当はラッチのタイミングが違う気もするけど、とりあえずね - const ConfigItem& item1 = gConfig->Get("luna-dipsw1"); + const ConfigItem& item1 = gConfig->Find("luna-dipsw1"); const std::string& str1 = item1.AsString(); if (str1.size() != 8) { item1.Err("must be 8 digits"); return false; } - const ConfigItem& item2 = gConfig->Get("luna-dipsw2"); + const ConfigItem& item2 = gConfig->Find("luna-dipsw2"); const std::string& str2 = item2.AsString(); if (str2.size() != 8) { item2.Err("must be 8 digits"); @@ -290,6 +293,45 @@ PIO0Device::Peek(uint32 addr) } } +bool +PIO0Device::MonitorUpdate() +{ + int y; + + monitor.Clear(); + + y = 0; + monitor.Print(0, y++, "PortA(DIPSW1):%c%c%c%c%c%c%c%c", + (dipsw1[0] ? '1' : '0'), + (dipsw1[1] ? '1' : '0'), + (dipsw1[2] ? '1' : '0'), + (dipsw1[3] ? '1' : '0'), + (dipsw1[4] ? '1' : '0'), + (dipsw1[5] ? '1' : '0'), + (dipsw1[6] ? '1' : '0'), + (dipsw1[7] ? '1' : '0')); + monitor.Print(0, y++, "PortB(DIPSW2):%c%c%c%c%c%c%c%c", + (dipsw2[0] ? '1' : '0'), + (dipsw2[1] ? '1' : '0'), + (dipsw2[2] ? '1' : '0'), + (dipsw2[3] ? '1' : '0'), + (dipsw2[4] ? '1' : '0'), + (dipsw2[5] ? '1' : '0'), + (dipsw2[6] ? '1' : '0'), + (dipsw2[7] ? '1' : '0')); + monitor.Puts(0, y++, "PortC"); + monitor.Puts(1, y++, TA::OnOff(xp_reset), "b7: XP Reset"); + monitor.Puts(1, y++, TA::OnOff(parity), "b6: Parity"); + monitor.Puts(1, y++, "b5: ---"); + monitor.Puts(1, y++, TA::OnOff(int5en), "b4: Int5 Enable"); + monitor.Puts(1, y++, TA::OnOff(int5rq), "b3: Int5 Request"); + monitor.Puts(1, y++, TA::OnOff(int1en), "b2: Int1 Enable"); + monitor.Puts(1, y++, "b1: ---"); + monitor.Puts(1, y++, TA::OnOff(int1rq), "b0: Intq Request"); + + return true; +} + // PortA (DIP-SW 1) 読み込み uint32 PIO0Device::GetPA() const