|
|
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();
26: ~VideoCtlrDevice() override;
27:
1.1.1.2 ! root 28: // 加工済みテキストパレットの先頭アドレスを取得
! 29: // レンダラとかからの参照用
! 30: const uint32 *GetCookedPalette() const { return cooked_palette; }
1.1 root 31:
32: protected:
33: // BusIO インタフェース
34: static const uint NPORT = 4096;
35: uint64 Read(uint32 addr);
36: uint64 Write(uint32 addr, uint32 data);
37: uint64 Peek(uint32 addr);
38:
39: private:
40: void SetR0(uint32 data);
41: void SetR1(uint32 data);
42: void SetR2(uint32 data);
1.1.1.2 ! root 43: void MakePalette();
1.1 root 44:
45: struct videoctlr videoctlr {};
46: union {
47: uint8 b[1024];
48: uint16 w[512];
49: } palette {};
1.1.1.2 ! root 50:
! 51: // xBGR32 形式のテキストパレット (レンダラ用に加工したもの)
! 52: uint32 cooked_palette[16];
1.1 root 53: };
54:
55: 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.