--- nono/vm/fdc.h 2026/04/29 17:04:55 1.1.1.6 +++ nono/vm/fdc.h 2026/04/29 17:05:11 1.1.1.7 @@ -4,10 +4,13 @@ // Licensed under nono-license.txt // +// +// FDC (uPD72065B) +// + #pragma once -#include "device.h" -#include "scheduler.h" +#include "event.h" enum fdc_phase_t { PHASE_IDLE = 0, @@ -19,6 +22,7 @@ enum fdc_phase_t { struct FDD { bool motor; // モーターオン bool seek; // シーク中/シーク完了割り込み保留中 + bool ready; }; struct FDC { @@ -103,14 +107,17 @@ struct FDC { class FDCDevice : public IODevice { using inherited = IODevice; - private: + static const int baseaddr = 0xe94000; public: FDCDevice(); virtual ~FDCDevice() override; - void ResetHard() override; + void ResetHard(bool poweron) override; + + // 強制レディ + void SetForceReady(bool force_ready_); protected: // BusIO インタフェース @@ -129,13 +136,17 @@ class FDCDevice : public IODevice void exec_phase(); void result_phase(); - struct FDC fdc {}; - struct FDD fdd[4] {}; - void Callback(Event& ev); void Interrupt(); + bool interrupt {}; // 割り込みを出している間は true + + struct FDC fdc {}; + struct FDD fdd[4] {}; + + bool force_ready {}; // 強制レディ + Event event { this }; // コマンドを名前に変換 @@ -145,4 +156,4 @@ class FDCDevice : public IODevice static const char *cmdnames_str[]; }; -extern std::unique_ptr gFDC; +extern FDCDevice *gFDC;