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