--- nono/vm/pio.cpp 2026/04/29 17:04:39 1.1.1.3 +++ nono/vm/pio.cpp 2026/04/29 17:04:42 1.1.1.4 @@ -38,6 +38,17 @@ i8255Device::~i8255Device() { } +// リセット +void +i8255Device::ResetHard() +{ + // clears the control register + // and place ports A, B, and C in input mode. + // The input latches in ports A, B, and C are not cleared. + + ctrl = 0b10011011; +} + // コントロールポートへの書き込み。 void i8255Device::WriteCtrl(uint32 data) @@ -99,6 +110,8 @@ PPIDevice::~PPIDevice() uint64 PPIDevice::Read(uint32 addr) { + gMPU->AddCycle(19); // InsideOut p.135 + switch (addr) { case 0: case 1: @@ -118,6 +131,8 @@ PPIDevice::Read(uint32 addr) uint64 PPIDevice::Write(uint32 addr, uint32 data) { + gMPU->AddCycle(19); // InsideOut p.135 + switch (addr) { case 0: case 1: @@ -200,7 +215,7 @@ PIO0Device::PIO0Device() gConfig->SetDefault("luna-dipsw1", "11110111"); break; case VMTYPE_LUNA88K: - gConfig->SetDefault("luna-dipsw1", "00111111"); + gConfig->SetDefault("luna-dipsw1", "11111111"); break; default: __unreachable(); @@ -470,6 +485,15 @@ PIO1Device::~PIO1Device() { } +// リセット +void +PIO1Device::ResetHard() +{ + inherited::ResetHard(); + + poffevent.Stop(); +} + uint64 PIO1Device::Read(uint32 addr) { @@ -602,7 +626,7 @@ PIO1Device::SetPC(int pc, int val) // 電源 OFF イベントのコールバック void -PIO1Device::PowerOffCallback(int arg) +PIO1Device::PowerOffCallback(Event& ev) { putlog(0, "電源 OFF"); gScheduler->RequestPowerOff();