X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fvdp.h;h=64d77981a8117f5f3cd7115ef6e6257c48976a39;hb=ce93735c3abce87854765403972df1d26382dd85;hp=74199a135b8baffb6a73c6b8e01ce214d3008f2c;hpb=6513a329c0b984945a50735a871abc5b7f08ec46;p=mdlife diff --git a/src/vdp.h b/src/vdp.h index 74199a1..64d7798 100644 --- a/src/vdp.h +++ b/src/vdp.h @@ -3,16 +3,33 @@ #include "hwregs.h" -#define VDP_VRAM 0x40000000 -#define VDP_CRAM 0xc0000000 -#define VDP_VSRAM 0x40000010 - #define vdp_setup_addr(type, addr) \ (VDP_CTL32 = ((type) | (((addr) & 0x3fff) << 16) | (((addr) >> 14) & 3))) #define vdp_setreg(reg, val) \ (VDP_CTL = 0x8000 | ((reg) << 8) | (val)) +#define vdp_wait_vblank() \ + while(!(VDP_STAT & VDP_ST_VBLANK)) + +#define vdp_wait_vblank_end() \ + while((VDP_STAT & VDP_ST_VBLANK)) + +#define vdp_vsync() \ + (vdp_wait_vblank_end(), vdp_wait_vblank()) + + +#define VDP_TILE_BG 0 +#define VDP_TILE_FG 0x8000 +#define VDP_TILE_PAL(x) ((x) << 13) +#define VDP_TILE_VFLIP 0x1000 +#define VDP_TILE_HFLIP 0x0800 +#define VDP_TILE_HVFLIP (VDP_TILE_HFLIP | VDP_TILE_VFLIP) +#define VDP_TILENAME(tile, pal, flags) \ + ((tile) | VDP_TILE_PAL(pal) | (flags)) + +#define VDP_ADDR2TILE(x) ((x) >> 5) + void vdp_init(void); void vdp_setcolor(int pal, int cidx, int r, int g, int b);