--- nono/vm/mfp.h 2026/04/29 17:04:52 1.1.1.8 +++ nono/vm/mfp.h 2026/04/29 17:05:17 1.1.1.13 @@ -4,10 +4,19 @@ // Licensed under nono-license.txt // +// +// MFP (MC68901) +// + #pragma once #include "device.h" -#include "scheduler.h" +#include "event.h" +#include "monitor.h" +#include + +class InterruptDevice; +class X68030Keyboard; struct MFP { @@ -175,8 +184,7 @@ struct MFP uint16 udr; }; -class MFPDevice - : public IODevice +class MFPDevice : public IODevice { using inherited = IODevice; @@ -186,15 +194,24 @@ class MFPDevice MFPDevice(); virtual ~MFPDevice() override; - void ResetHard() override; - void MonitorUpdate(TextScreen&) override; + bool Init() override; + void ResetHard(bool poweron) override; // 割り込みアクノリッジ int InterruptAcknowledge(); + // HSync 入力 + void SetHSync(bool hsync); + // VDisp 入力 void SetVDisp(bool vdisp); + // 電源ボタン状態入力 + void SetPowSW(bool powsw); + + // ALARM 信号入力 + void SetAlarmOut(bool alarm); + // KEY CTRL 状態を設定する void SetKeyCtrl(bool ctrl); @@ -239,9 +256,16 @@ class MFPDevice // 割り込み信号線の状態を変える void ChangeInterrupt(); + DECLARE_MONITOR_CALLBACK(MonitorUpdate); + struct MFP mfp {}; - Event event[4] {}; - Event key_event {}; + std::array event {}; + Event key_event { this }; + + Monitor monitor { this }; + + InterruptDevice *interrupt {}; + X68030Keyboard *keyboard {}; static const char *intrname[]; static const char *gpipname[]; @@ -250,4 +274,6 @@ class MFPDevice static const int timer_vector[4]; }; -extern std::unique_ptr gMFP; +static inline MFPDevice *GetMFPDevice() { + return Object::GetObject(OBJ_MFP); +}