--- nono/vm/fdc.cpp 2026/04/29 17:04:35 1.1.1.4 +++ nono/vm/fdc.cpp 2026/04/29 17:04:44 1.1.1.6 @@ -5,9 +5,11 @@ // #include "fdc.h" -#include "ioctlr.h" +#include "pedec.h" #include "scheduler.h" +std::unique_ptr gFDC; + // コンストラクタ FDCDevice::FDCDevice() { @@ -30,12 +32,15 @@ void FDCDevice::ResetHard() { // XXX 他には + event.Stop(); idle_phase(); } uint64 FDCDevice::Read(uint32 addr) { + gMPU->AddCycle(19); // InsideOut p.135 + switch (addr) { case 0: return ReadStatus(); @@ -52,6 +57,8 @@ FDCDevice::Read(uint32 addr) uint64 FDCDevice::Write(uint32 addr, uint32 data) { + gMPU->AddCycle(19); // InsideOut p.135 + switch (addr) { case 0: return 0; @@ -253,6 +260,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; @@ -305,9 +317,9 @@ FDCDevice::result_phase() // イベントコールバック void -FDCDevice::Callback(int arg) +FDCDevice::Callback(Event& ev) { - switch (arg) { + switch (ev.code) { case FDC::CMD_RECALIBRATE: fdd[fdc.accdrive].seek = false; fdc.DIO = DIOtoHost; @@ -320,7 +332,7 @@ FDCDevice::Callback(int arg) void FDCDevice::Interrupt() { - gIOCtlr->IntFDC(); + gPEDEC->AssertINT(this); } // コマンド名