Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/snes/ppu/background/background.hpp
2 views
1
struct Background {
2
struct ID { enum { BG1, BG2, BG3, BG4 }; };
3
unsigned id;
4
5
struct Mode { enum { BPP2, BPP4, BPP8, Mode7, Inactive }; };
6
struct ScreenSize { enum { Size32x32, Size32x64, Size64x32, Size64x64 }; };
7
struct TileSize { enum { Size8x8, Size16x16 }; };
8
struct Screen { enum { Main, Sub }; };
9
10
struct Regs {
11
uint16 tiledata_addr;
12
uint16 screen_addr;
13
uint2 screen_size;
14
uint4 mosaic;
15
bool tile_size;
16
17
unsigned mode;
18
unsigned priority0;
19
unsigned priority1;
20
21
bool main_enable;
22
bool sub_enable;
23
24
uint16 hoffset;
25
uint16 voffset;
26
} regs;
27
28
struct Cache {
29
uint16 hoffset;
30
uint16 voffset;
31
} cache;
32
33
struct Output {
34
struct Pixel {
35
unsigned priority; //0 = none (transparent)
36
uint8 palette;
37
uint16 tile;
38
} main, sub;
39
} output;
40
41
struct Mosaic : Output::Pixel {
42
unsigned vcounter;
43
unsigned voffset;
44
unsigned hcounter;
45
unsigned hoffset;
46
} mosaic;
47
48
struct {
49
signed x;
50
signed y;
51
52
unsigned tile_counter;
53
unsigned tile;
54
unsigned priority;
55
unsigned palette_number;
56
unsigned palette_index;
57
uint8 data[8];
58
};
59
60
void frame();
61
void scanline();
62
void begin();
63
void run(bool screen);
64
void reset();
65
66
void get_tile();
67
unsigned get_tile_color();
68
unsigned get_tile(unsigned x, unsigned y);
69
signed clip(signed n);
70
void begin_mode7();
71
void run_mode7();
72
73
void serialize(serializer&);
74
Background(PPU &self, unsigned id);
75
76
PPU &self;
77
friend class PPU;
78
};
79
80