summaryrefslogtreecommitdiffstats
path: root/apps/plugins/rockboy/lcd-gb.h
blob: 36b971a88b9d59257d41105a0d3ccb3c865192f6 (plain)
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


#ifndef __LCD_GB_H__
#define __LCD_GB_H__

#include "defs.h"

struct vissprite
{
    byte *buf;
    int x;
    byte pal, pri;
};

struct scan
{
    int bg[64];
    int wnd[64];
#if LCD_DEPTH == 1
    byte buf[8][256];
#elif LCD_DEPTH == 2
    byte buf[4][256];
#elif LCD_DEPTH > 4
    byte buf[256];
#endif
    un16 pal[64];
    byte pri[256];
    struct vissprite vs[16];
    int ns, l, x, y, s, t, u, v, wx, wy, wt, wv;
};

struct obj
{
    byte y;
    byte x;
    byte pat;
    byte flags;
};

struct lcd
{
    byte vbank[2][8192];
    union
    {
        byte mem[256];
        struct obj obj[40];
    } oam;
    byte pal[128];
};

extern struct lcd lcd;
extern struct scan scan;

void lcd_begin(void) ICODE_ATTR;
void lcd_refreshline(void) ICODE_ATTR;
void pal_write(int i, byte b) ICODE_ATTR;
void pal_write_dmg(int i, int mapnum, byte d) ICODE_ATTR;
void vram_write(addr a, byte b) ICODE_ATTR;
void vram_dirty(void) ICODE_ATTR;
void pal_dirty(void) ICODE_ATTR;
void lcd_reset(void);

#endif