|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.7 root 7: //
8: // CRTC
9: //
10:
1.1 root 11: #pragma once
12:
1.1.1.9 root 13: #include "device.h"
1.1.1.7 root 14: #include "event.h"
1.1 root 15:
1.1.1.9 root 16: class MFPDevice;
17: class TVRAMDevice;
1.1.1.12! root 18: class VideoCtlrDevice;
1.1.1.9 root 19:
1.1 root 20: struct CRTC
21: {
1.1.1.7 root 22: // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
23: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
24: // R00 | - | 水平トータル |
25: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
26: // R01 | - | 水平同期終了位置 |
27: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
28: // R02 | - | 水平表示開始位置 |
29: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
30: // R03 | - | 水平表示終了位置 |
31: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
32: //
33: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
34: // R04 | - | 垂直トータル |
35: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
36: // R05 | - | 垂直同期終了位置 |
37: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
38: // R06 | - | 垂直表示開始位置 |
39: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
40: // R07 | - | 垂直表示終了位置 |
41: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
42: //
43: // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
44: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
45: // R08 | - | 外部同期水平アジャスト |
46: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
47: // R09 | - | ラスタ番号 |
48: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
49: // R10 | - | テキスト画面スクロール X位置 |
50: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
51: // R11 | - | テキスト画面スクロール Y位置 |
52: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
53: //
54: // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
55: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
56: // R12 | - | グラフィック画面スクロール X0 |
57: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
58: // R13 | - | グラフィック画面スクロール Y0 |
59: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
60: // R14 | - | グラフィック画面スクロール X1 |
61: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
62: // R15 | - | グラフィック画面スクロール Y1 |
63: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
64: // R16 | - | グラフィック画面スクロール X2 |
65: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
66: // R17 | - | グラフィック画面スクロール Y2 |
67: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
68: // R18 | - | グラフィック画面スクロール X3 |
69: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
70: // R19 | - | グラフィック画面スクロール Y3 |
71: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
72: //
73: // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
74: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1.1.1.8 root 75: // R20 | - |MEM|SIZ| COL | - |HF | VD | HD |
1.1.1.7 root 76: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
77: // R21 | - |MEN|SA | AP | CP |
78: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
79: // R22 | ソースラスタ | デスティネーションラスタ |
80: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
81: // R23 | マスクパターン |
82: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1.1.1.11 root 83: //
84: // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
85: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
86: // OP | - |RC | 0 |FC |VI |
1.1.1.7 root 87: // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
88:
1.1 root 89: uint16 r[24];
90: uint16 op;
91:
92: static const uint32 R00 = 0x00; // $E80000
93: static const uint32 R01 = 0x01; // $E80002
94: static const uint32 R02 = 0x02; // $E80004
95: static const uint32 R03 = 0x03; // $E80006
96: static const uint32 R04 = 0x04; // $E80008
97: static const uint32 R05 = 0x05; // $E8000A
98: static const uint32 R06 = 0x06; // $E8000C
99: static const uint32 R07 = 0x07; // $E8000E
100: static const uint32 R08 = 0x08; // $E80010
101: static const uint32 R09 = 0x09; // $E80012
102: static const uint32 R10 = 0x0a; // $E80014
103: static const uint32 R11 = 0x0b; // $E80016
104: static const uint32 R12 = 0x0c; // $E80018
105: static const uint32 R13 = 0x0d; // $E8001A
106: static const uint32 R14 = 0x0e; // $E8001C
107: static const uint32 R15 = 0x0f; // $E8001E
108: static const uint32 R16 = 0x10; // $E80020
109: static const uint32 R17 = 0x11; // $E80022
110: static const uint32 R18 = 0x12; // $E80024
111: static const uint32 R19 = 0x13; // $E80026
112: static const uint32 R20 = 0x14; // $E80028
113: static const uint32 R21 = 0x15; // $E8002A
114: static const uint32 R22 = 0x16; // $E8002C
115: static const uint32 R23 = 0x17; // $E8002E
116: static const uint32 REG_END = 0x18;
1.1.1.5 root 117: static const uint32 REG_OP = 0x240; // $E80480
1.1.1.7 root 118:
1.1.1.8 root 119: // R20
120: static const uint16 R20_MEM = 0x0800;
121: static const uint16 R20_SIZ = 0x0400;
122: static const uint16 R20_COL = 0x0300;
123: static const uint16 R20_HF = 0x0010;
124: static const uint16 R20_VD = 0x000c;
125: static const uint16 R20_HD = 0x0003;
126:
1.1.1.7 root 127: // 動作ポート
128: static const uint32 OP_RC = 0x08; // ラスターコピー開始(%1)
129: static const uint32 OP_FC = 0x02; // 高速クリア開始(%1)
130: static const uint32 OP_VI = 0x01; // 画像取り込み開始(%1)
1.1 root 131: };
132:
1.1.1.6 root 133: class CRTCDevice : public IODevice
1.1 root 134: {
1.1.1.2 root 135: using inherited = IODevice;
1.1 root 136: public:
137: CRTCDevice();
1.1.1.10 root 138: ~CRTCDevice() override;
1.1 root 139:
1.1.1.9 root 140: bool Init() override;
1.1.1.7 root 141: void ResetHard(bool poweron) override;
1.1 root 142:
1.1.1.11 root 143: busdata Read(busaddr addr) override;
144: busdata Write(busaddr addr, uint32 data) override;
145: busdata Peek1(uint32 offset) override;
1.1 root 146:
147: private:
1.1.1.11 root 148: static inline uint32 Decoder(uint32 addr);
149:
1.1.1.10 root 150: // ワード読み出し
1.1.1.11 root 151: busdata Peek2(uint32 addr) const;
1.1.1.7 root 152: // レジスタへの書き込み
1.1.1.2 root 153: void SetReg(uint32 offset, uint32 data);
1.1.1.7 root 154: // 動作ポートへの書き込み
155: void WriteOp(uint32 data);
156:
157: // 水平同期信号イベント
158: void HSyncCallback(Event& ev);
1.1 root 159:
1.1.1.8 root 160: // ラスターコピー完了イベント
161: void RasterCallback(Event& ev);
162:
1.1 root 163: // 垂直表示期間イベント
1.1.1.3 root 164: void VDispCallback(Event& ev);
1.1 root 165:
1.1.1.7 root 166: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
167:
1.1 root 168: struct CRTC crtc {};
169:
1.1.1.8 root 170: // ラスターコピー指示
171: bool raster_copy {};
172:
1.1.1.9 root 173: MFPDevice *mfp {};
174: TVRAMDevice *tvram {};
1.1.1.12! root 175: VideoCtlrDevice *videoctlr {};
1.1.1.9 root 176:
1.1.1.7 root 177: Event hsync_event { this };
1.1.1.6 root 178: Event vdisp_event { this };
1.1.1.8 root 179: Event raster_event { this };
1.1.1.7 root 180:
1.1.1.12! root 181: Monitor *monitor {};
1.1 root 182: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.