|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "device.h"
10:
11: class SpriteDevice
12: : public IODevice
13: {
1.1.1.3 root 14: using inherited = IODevice;
1.1 root 15: private:
16: static const int baseaddr = 0xeb0000;
17:
18: struct sprite_scroll {
19: uint16 xpos;
20: uint16 ypos;
21: uint16 col;
22: uint16 prw;
23: } __attribute__((__packed__));
24:
25: struct sprite_ctrl {
26: struct sprite_scroll sprite[128];
27:
28: uint16 bg0x;
29: uint16 bg0y;
30: uint16 bg1x;
31: uint16 bg1y;
32: uint16 bgctrl;
33:
34: uint16 htotal; // 水平トータル
35: uint16 hdisp; // 水平表示位置
36: uint16 vdisp; // 垂直表示位置
37: uint16 res; // 解像度
38: };
39:
40: public:
41: SpriteDevice();
1.1.1.4 root 42: virtual ~SpriteDevice() override;
1.1 root 43:
1.1.1.3 root 44: uint64 Read8(uint32 addr) override;
45: uint64 Read16(uint32 addr) override;
46: uint64 Write8(uint32 addr, uint32 data) override;
47: uint64 Write16(uint32 addr, uint32 data) override;
48: uint64 Peek8(uint32 addr) override;
1.1 root 49:
50: private:
51: struct sprite_ctrl reg {};
1.1.1.2 root 52: std::unique_ptr<uint8[]> mem {};
1.1 root 53: };
1.1.1.5 ! root 54:
! 55: extern std::unique_ptr<SpriteDevice> gSprite;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.