2010-12-29 11:03:42 +00:00
|
|
|
struct LCD : Processor, MMIO {
|
|
|
|
#include "mmio/mmio.hpp"
|
|
|
|
|
|
|
|
struct Status {
|
2010-12-30 07:18:47 +00:00
|
|
|
unsigned lx;
|
|
|
|
|
|
|
|
//$ff40 LCDC
|
|
|
|
bool display_enable;
|
|
|
|
bool window_tilemap_select;
|
|
|
|
bool window_display_enable;
|
|
|
|
bool bg_tiledata_select;
|
|
|
|
bool bg_tilemap_select;
|
|
|
|
bool obj_size;
|
|
|
|
bool obj_enable;
|
2011-01-02 04:46:54 +00:00
|
|
|
bool bg_enable;
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
//$ff41 STAT
|
|
|
|
bool interrupt_lyc;
|
|
|
|
bool interrupt_oam;
|
|
|
|
bool interrupt_vblank;
|
|
|
|
bool interrupt_hblank;
|
|
|
|
|
|
|
|
//$ff42 SCY
|
|
|
|
uint8 scy;
|
|
|
|
|
|
|
|
//$ff43 SCX
|
|
|
|
uint8 scx;
|
|
|
|
|
|
|
|
//$ff44 LY
|
|
|
|
uint8 ly;
|
|
|
|
|
|
|
|
//$ff45 LYC
|
|
|
|
uint8 lyc;
|
|
|
|
|
|
|
|
//$ff47 BGP
|
|
|
|
uint8 bgp[4];
|
|
|
|
|
|
|
|
//$ff48 OBP0
|
|
|
|
//$ff49 OBP1
|
2010-12-31 05:43:47 +00:00
|
|
|
uint8 obp[2][4];
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
//$ff4a WY
|
|
|
|
uint8 wy;
|
|
|
|
|
|
|
|
//$ff4b WX
|
|
|
|
uint8 wx;
|
2010-12-29 11:03:42 +00:00
|
|
|
} status;
|
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
uint8 screen[160 * 144];
|
2010-12-29 11:03:42 +00:00
|
|
|
uint8 vram[8192];
|
|
|
|
uint8 oam[160];
|
2011-01-03 04:28:36 +00:00
|
|
|
uint8 line[160];
|
2011-01-02 04:46:54 +00:00
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
static void Main();
|
|
|
|
void main();
|
|
|
|
void add_clocks(unsigned clocks);
|
|
|
|
void scanline();
|
|
|
|
void frame();
|
|
|
|
void render();
|
2011-01-03 04:28:36 +00:00
|
|
|
uint16 read_tile(bool select, unsigned x, unsigned y);
|
2011-01-02 04:46:54 +00:00
|
|
|
void render_bg();
|
|
|
|
void render_window();
|
|
|
|
void render_obj();
|
2010-12-30 07:18:47 +00:00
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
void power();
|
|
|
|
};
|
|
|
|
|
|
|
|
extern LCD lcd;
|