--- nono/vm/mfp.h 2026/04/29 17:04:50 1.1.1.7 +++ nono/vm/mfp.h 2026/04/29 17:04:59 1.1.1.10 @@ -7,7 +7,9 @@ #pragma once #include "device.h" +#include "monitor.h" #include "scheduler.h" +#include struct MFP { @@ -175,8 +177,7 @@ struct MFP uint16 udr; }; -class MFPDevice - : public IODevice +class MFPDevice : public IODevice { using inherited = IODevice; @@ -187,7 +188,6 @@ class MFPDevice virtual ~MFPDevice() override; void ResetHard() override; - void MonitorUpdate(TextScreen&) override; // 割り込みアクノリッジ int InterruptAcknowledge(); @@ -198,8 +198,8 @@ class MFPDevice // KEY CTRL 状態を設定する void SetKeyCtrl(bool ctrl); - // RR 線の状態を返す - bool IsRR() const; + // キーボードからの送信が可能なら true を返す。 + bool RxIsReady() const; // キーボードからデータを受信 void Rx(uint32 data); @@ -223,6 +223,12 @@ class MFPDevice void SetRSR(uint32 data); void SetUDR(uint32 data); + // RSR::BF ビットの状態を変える + void SetBF(); + void ClearBF(); + // MFP の RR 線の状態を返す + bool IsRR() const; + // イベントコールバック void TimerCallback(Event& ev); void KeyCallback(Event& ev); @@ -233,15 +239,13 @@ class MFPDevice // 割り込み信号線の状態を変える void ChangeInterrupt(); - struct MFP mfp {}; - Event event[4] {}; - Event key_event {}; + DECLARE_MONITOR_CALLBACK(MonitorUpdate); - // Receiver Ready 線の状態 - bool rr {}; + struct MFP mfp {}; + std::array event {}; + Event key_event { this }; - // システムポート#4 の KEY CTRL 状態 - bool key_ctrl {}; + Monitor monitor { this }; static const char *intrname[]; static const char *gpipname[];