|
|
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:
1.1.1.6 ! root 11: class SpriteDevice : public IODevice
1.1 root 12: {
1.1.1.3 root 13: using inherited = IODevice;
1.1 root 14: private:
15: static const int baseaddr = 0xeb0000;
16:
17: struct sprite_scroll {
18: uint16 xpos;
19: uint16 ypos;
20: uint16 col;
21: uint16 prw;
22: } __attribute__((__packed__));
23:
24: struct sprite_ctrl {
25: struct sprite_scroll sprite[128];
26:
27: uint16 bg0x;
28: uint16 bg0y;
29: uint16 bg1x;
30: uint16 bg1y;
31: uint16 bgctrl;
32:
33: uint16 htotal; // 水平トータル
34: uint16 hdisp; // 水平表示位置
35: uint16 vdisp; // 垂直表示位置
36: uint16 res; // 解像度
37: };
38:
39: public:
40: SpriteDevice();
1.1.1.4 root 41: virtual ~SpriteDevice() override;
1.1 root 42:
1.1.1.3 root 43: uint64 Read8(uint32 addr) override;
44: uint64 Read16(uint32 addr) override;
45: uint64 Write8(uint32 addr, uint32 data) override;
46: uint64 Write16(uint32 addr, uint32 data) override;
47: uint64 Peek8(uint32 addr) override;
1.1 root 48:
49: private:
50: struct sprite_ctrl reg {};
1.1.1.2 root 51: std::unique_ptr<uint8[]> mem {};
1.1 root 52: };
1.1.1.5 root 53:
54: 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.