-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobject.hpp
More file actions
91 lines (73 loc) · 1.53 KB
/
object.hpp
File metadata and controls
91 lines (73 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
struct OAM {
auto read(uint10 address) -> uint8;
auto write(uint10 address, uint8 data) -> void;
struct Object {
alwaysinline auto width() const -> uint;
alwaysinline auto height() const -> uint;
uint9 x;
uint8 y;
uint8 character;
uint1 nameselect;
uint1 vflip;
uint1 hflip;
uint2 priority;
uint3 palette;
uint1 size;
} object[128];
};
struct Object {
alwaysinline auto addressReset() -> void;
alwaysinline auto setFirstSprite() -> void;
auto frame() -> void;
auto scanline() -> void;
auto evaluate(uint7 index) -> void;
auto run() -> void;
auto fetch() -> void;
auto power() -> void;
auto onScanline(PPU::OAM::Object&) -> bool;
auto serialize(serializer&) -> void;
OAM oam;
struct IO {
uint1 aboveEnable;
uint1 belowEnable;
uint1 interlace;
uint3 baseSize;
uint2 nameselect;
uint16 tiledataAddress;
uint7 firstSprite;
uint8 priority[4];
uint1 timeOver;
uint1 rangeOver;
} io;
struct Latch {
uint7 firstSprite;
} latch;
struct Item {
uint1 valid;
uint7 index;
};
struct Tile {
uint1 valid;
uint9 x;
uint2 priority;
uint8 palette;
uint1 hflip;
uint32 data;
};
struct State {
uint x;
uint y;
uint itemCount;
uint tileCount;
bool active;
Item item[2][32];
Tile tile[2][34];
} t;
struct Output {
struct Pixel {
uint8 priority; //0 = none (transparent)
uint8 palette;
} above, below;
} output;
friend class PPU;
};