per-line scrolling test
[mdlife] / src / vdp.h
1 #ifndef VDP_H_
2 #define VDP_H_
3
4 #include "hwregs.h"
5
6 #define vdp_setup_addr(type, addr) \
7         (VDP_CTL32 = ((type) | (((addr) & 0x3fff) << 16) | (((addr) >> 14) & 3)))
8
9 #define vdp_setreg(reg, val) \
10         (VDP_CTL = 0x8000 | ((reg) << 8) | (val))
11
12 #define vdp_wait_vblank() \
13         while(!(VDP_STAT & VDP_ST_VBLANK))
14
15 #define vdp_wait_vblank_end() \
16         while((VDP_STAT & VDP_ST_VBLANK))
17
18 #define vdp_vsync() \
19         (vdp_wait_vblank_end(), vdp_wait_vblank())
20
21
22 #define VDP_TILE_BG                     0
23 #define VDP_TILE_FG                     0x8000
24 #define VDP_TILE_PAL(x)         ((x) << 13)
25 #define VDP_TILE_VFLIP          0x1000
26 #define VDP_TILE_HFLIP          0x0800
27 #define VDP_TILE_HVFLIP         (VDP_TILE_HFLIP | VDP_TILE_VFLIP)
28 #define VDP_TILENAME(tile, pal, flags)  \
29         ((tile) | VDP_TILE_PAL(pal) | (flags))
30
31 #define VDP_ADDR2TILE(x)        ((x) >> 5)
32
33 void vdp_init(void);
34 void vdp_setcolor(int pal, int cidx, int r, int g, int b);
35
36 #endif  /* VDP_H_ */