--- nono/vm/crtc.h 2026/04/29 17:05:17 1.1.1.9 +++ nono/vm/crtc.h 2026/04/29 17:06:00 1.1.1.14 @@ -11,12 +11,10 @@ #pragma once #include "device.h" -#include "event.h" -#include "monitor.h" class MFPDevice; -class Renderer; class TVRAMDevice; +class VideoCtlrDevice; struct CRTC { @@ -81,7 +79,10 @@ struct CRTC // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ // R23 | マスクパターン | // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - // R24 | - |RC | 0 |FC |VI | + // + // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + // OP | - |RC | 0 |FC |VI | // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ uint16 r[24]; @@ -133,47 +134,54 @@ class CRTCDevice : public IODevice using inherited = IODevice; public: CRTCDevice(); - virtual ~CRTCDevice() override; + ~CRTCDevice() override; bool Init() override; void ResetHard(bool poweron) override; - protected: - // BusIO インタフェース - static const uint NPORT = 0x800; - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - uint64 Peek(uint32 offset); + busdata Read(busaddr addr) override; + busdata Write(busaddr addr, uint32 data) override; + busdata Peek1(uint32 offset) override; private: + static inline uint32 Decoder(uint32 addr); + + // ワード読み出し + busdata Peek2(uint32 addr) const; // レジスタへの書き込み void SetReg(uint32 offset, uint32 data); // 動作ポートへの書き込み void WriteOp(uint32 data); // 水平同期信号イベント - void HSyncCallback(Event& ev); + void HSyncCallback(Event *); // ラスターコピー完了イベント - void RasterCallback(Event& ev); + void RasterCallback(Event *); // 垂直表示期間イベント - void VDispCallback(Event& ev); + void VDispCallback(Event *); - DECLARE_MONITOR_CALLBACK(MonitorUpdate); + DECLARE_MONITOR_SCREEN(MonitorScreen); struct CRTC crtc {}; // ラスターコピー指示 bool raster_copy {}; + // XXX もうちょっとなんとかする + uint hsync_state {}; + uint vdisp_state {}; + MFPDevice *mfp {}; - Renderer *renderer {}; TVRAMDevice *tvram {}; + VideoCtlrDevice *videoctlr {}; + + Event *hsync_event {}; + Event *vdisp_event {}; + Event *raster_event {}; - Event hsync_event { this }; - Event vdisp_event { this }; - Event raster_event { this }; + Monitor *monitor {}; - Monitor monitor { this }; + static const busdata wait; };