Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/gameboy/lcd/lcd.hpp
2 views
1
struct LCD : Processor, MMIO {
2
#include "mmio/mmio.hpp"
3
4
struct Status {
5
unsigned lx;
6
unsigned wyc;
7
8
//$ff40 LCDC
9
bool display_enable;
10
bool window_tilemap_select;
11
bool window_display_enable;
12
bool bg_tiledata_select;
13
bool bg_tilemap_select;
14
bool ob_size;
15
bool ob_enable;
16
bool bg_enable;
17
18
//$ff41 STAT
19
bool interrupt_lyc;
20
bool interrupt_oam;
21
bool interrupt_vblank;
22
bool interrupt_hblank;
23
24
//$ff42 SCY
25
uint8 scy;
26
27
//$ff43 SCX
28
uint8 scx;
29
30
//$ff44 LY
31
uint8 ly;
32
33
//$ff45 LYC
34
uint8 lyc;
35
36
//$ff4a WY
37
uint8 wy;
38
39
//$ff4b WX
40
uint8 wx;
41
42
//$ff4f VBK
43
bool vram_bank;
44
45
//$ff68 BGPI
46
bool bgpi_increment;
47
uint6 bgpi;
48
49
//$ff6a OBPI
50
bool obpi_increment;
51
uint8 obpi;
52
} status;
53
54
uint16 screen[160 * 144];
55
uint16 line[160];
56
struct Origin { enum : unsigned { None, BG, BGP, OB }; };
57
uint8 origin[160];
58
59
uint8 vram[16384]; //GB = 8192, GBC = 16384
60
uint8 oam[160];
61
uint8 bgp[4];
62
uint8 obp[2][4];
63
uint8 bgpd[64];
64
uint8 obpd[64];
65
66
static void Main();
67
void main();
68
void add_clocks(unsigned clocks);
69
void scanline();
70
void frame();
71
72
unsigned hflip(unsigned data) const;
73
74
//dmg.cpp
75
void dmg_render();
76
uint16 dmg_read_tile(bool select, unsigned x, unsigned y);
77
void dmg_render_bg();
78
void dmg_render_window();
79
void dmg_render_ob();
80
81
//cgb.cpp
82
void cgb_render();
83
void cgb_read_tile(bool select, unsigned x, unsigned y, unsigned &tile, unsigned &attr, unsigned &data);
84
void cgb_render_bg();
85
void cgb_render_window();
86
void cgb_render_ob();
87
88
void power();
89
90
void serialize(serializer&);
91
LCD();
92
};
93
94
extern LCD lcd;
95
96