--- nono/vm/pio.h 2026/04/29 17:05:29 1.1.1.13 +++ nono/vm/pio.h 2026/04/29 17:06:00 1.1.1.16 @@ -11,9 +11,9 @@ #pragma once #include "device.h" -#include "monitor.h" #include +class ADPCMDevice; class InterruptDevice; class LCDDevice; class MPU64180Device; @@ -45,7 +45,7 @@ class i8255Device : public IODevice virtual void SetPC(uint, uint) = 0; // 共通部分 - int MonitorUpdateCommon(TextScreen& screen, int y); + int MonitorScreenCommon(TextScreen& screen, int y); // 7 6 5 4 3 2 1 0 // 1 AM AM AD CHD BM BD CLD @@ -80,8 +80,7 @@ class PPIDevice : public i8255Device PPIDevice(); ~PPIDevice() override; - // ADPCM のサンプリングレートの 2bit を取得する - uint8 GetADPCMRate() const { return adpcm_rate; } + bool Init() override; protected: // BusIO インタフェース @@ -91,11 +90,13 @@ class PPIDevice : public i8255Device busdata PeekPort(uint32 offset); private: + uint32 GetPC() const; void SetPC(uint, uint) override; - bool pan_left {}; - bool pan_right {}; - uint adpcm_rate {}; + // ADPCM サンプリングレートの設定値(0..3)をこちらでも持っておく。 + uint32 adpcm_rate {}; + + ADPCMDevice *adpcm {}; }; class PIO0Device : public i8255Device @@ -133,7 +134,7 @@ class PIO0Device : public i8255Device void SetPC(uint, uint) override; void ChangeInterrupt(); - DECLARE_MONITOR_CALLBACK(MonitorUpdate); + DECLARE_MONITOR_SCREEN(MonitorScreen); bool dipsw1[8] {}; bool dipsw2[8] {}; @@ -143,7 +144,7 @@ class PIO0Device : public i8255Device bool parity {}; // $40 パリティ有効/無効 bool xp_reset {}; // $80 XP リセット - Monitor monitor { this }; + Monitor *monitor {}; InterruptDevice *interrupt {}; PIO1Device *pio1 {}; @@ -160,7 +161,7 @@ class PIO1Device : public i8255Device void ResetHard(bool poweron) override; // PIO0 の下請け - void MonitorUpdatePIO1(TextScreen& screen, int y); + void MonitorScreenPIO1(TextScreen& screen, int y); // BusIO インタフェース // (内蔵 ROM からのアクセス用に特別に public にしてある) @@ -174,7 +175,7 @@ class PIO1Device : public i8255Device uint32 GetPC() const; void SetPC(uint, uint) override; - DECLARE_MONITOR_CALLBACK(MonitorUpdate); + DECLARE_MONITOR_SCREEN(MonitorScreen); bool power {}; // パワーダウン (false で電源オフ指示) bool xp_intreq {}; // XP 割り込み要求。あり(true)なら %0 @@ -184,12 +185,12 @@ class PIO1Device : public i8255Device PowerDevice *powerdev {}; }; -static inline PPIDevice *GetPPIDevice() { +inline PPIDevice *GetPPIDevice() { return Object::GetObject(OBJ_PPI); } -static inline PIO0Device *GetPIO0Device() { +inline PIO0Device *GetPIO0Device() { return Object::GetObject(OBJ_PIO0); } -static inline PIO1Device *GetPIO1Device() { +inline PIO1Device *GetPIO1Device() { return Object::GetObject(OBJ_PIO1); }