|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: #pragma once
8:
9: #include "device.h"
10:
11: class VideoCtlrDevice
12: : public IODevice
13: {
14: using inherited = IODevice;
15: private:
16: static const int baseaddr = 0xe82000;
17:
18: struct videoctlr {
19: uint16 r0;
20: uint16 r1;
21: uint16 r2;
22: };
23:
24: public:
25: VideoCtlrDevice();
1.1.1.4 ! root 26: virtual ~VideoCtlrDevice() override;
1.1 root 27:
1.1.1.3 root 28: void ResetHard() override;
29:
1.1.1.2 root 30: // 加工済みテキストパレットの先頭アドレスを取得
31: // レンダラとかからの参照用
32: const uint32 *GetCookedPalette() const { return cooked_palette; }
1.1 root 33:
34: protected:
35: // BusIO インタフェース
36: static const uint NPORT = 4096;
37: uint64 Read(uint32 addr);
38: uint64 Write(uint32 addr, uint32 data);
39: uint64 Peek(uint32 addr);
40:
41: private:
42: void SetR0(uint32 data);
43: void SetR1(uint32 data);
44: void SetR2(uint32 data);
1.1.1.2 root 45: void MakePalette();
1.1 root 46:
47: struct videoctlr videoctlr {};
48: union {
49: uint8 b[1024];
50: uint16 w[512];
51: } palette {};
1.1.1.2 root 52:
53: // xBGR32 形式のテキストパレット (レンダラ用に加工したもの)
1.1.1.3 root 54: uint32 cooked_palette[16] {};
1.1 root 55: };
56:
57: extern std::unique_ptr<VideoCtlrDevice> gVideoCtlr;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.