--- nono/vm/fdc.cpp 2026/04/29 17:04:41 1.1.1.5 +++ nono/vm/fdc.cpp 2026/04/29 17:04:50 1.1.1.7 @@ -5,9 +5,11 @@ // #include "fdc.h" -#include "ioctlr.h" +#include "pedec.h" #include "scheduler.h" +std::unique_ptr gFDC; + // コンストラクタ FDCDevice::FDCDevice() { @@ -35,11 +37,11 @@ FDCDevice::ResetHard() } uint64 -FDCDevice::Read(uint32 addr) +FDCDevice::Read(uint32 offset) { gMPU->AddCycle(19); // InsideOut p.135 - switch (addr) { + switch (offset) { case 0: return ReadStatus(); case 1: @@ -53,11 +55,11 @@ FDCDevice::Read(uint32 addr) } uint64 -FDCDevice::Write(uint32 addr, uint32 data) +FDCDevice::Write(uint32 offset, uint32 data) { gMPU->AddCycle(19); // InsideOut p.135 - switch (addr) { + switch (offset) { case 0: return 0; @@ -75,7 +77,8 @@ FDCDevice::Write(uint32 addr, uint32 dat (fdc.drivesel & 8) ? " #3" : ""); } if ((data & 0xe0) != 0) { - putlog(0, "未実装ビット書き込み $%06x <- $%02x", addr, data); + putlog(0, "未実装ビット書き込み $%06x <- $%02x", + gMPU->GetPaddr(), data); } return 0; @@ -97,7 +100,7 @@ FDCDevice::Write(uint32 addr, uint32 dat } uint64 -FDCDevice::Peek(uint32 addr) +FDCDevice::Peek(uint32 offset) { // XXX 未実装 return 0xff; @@ -258,6 +261,11 @@ FDCDevice::exec_phase() case FDC::CMD_SENSE_INTERRUPT_STATUS: { putlog(1, "Exec フェーズ: SENSE INTERRUPT STATUS"); + // XXX とりあえずここで割り込みを下げる。 + // 実際には割り込み状態をラッチして信号線に出すというコマンドで + // 割り込み要因がオフになっていればそれによってネゲートされる + // ということのようだ。 + gPEDEC->NegateINT(this); // XXX まだフロッピー挿入はない uint8 st0 = 0; st0 |= FDC::ST0_IC_NT; @@ -325,7 +333,7 @@ FDCDevice::Callback(Event& ev) void FDCDevice::Interrupt() { - gIOCtlr->IntFDC(); + gPEDEC->AssertINT(this); } // コマンド名