megadrive_test1
diff src/main.c @ 6:862f8a034cae
expanding the megadrive code
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 11 Feb 2017 08:56:42 +0200 |
parents | f99eab59e7dc |
children | 8253942b0a1a |
line diff
1.1 --- a/src/main.c Wed Feb 01 14:40:19 2017 +0200 1.2 +++ b/src/main.c Sat Feb 11 08:56:42 2017 +0200 1.3 @@ -1,12 +1,32 @@ 1.4 #include "vdp.h" 1.5 1.6 +static const unsigned char pal[][3] = { 1.7 + {0, 0, 0}, {64, 128, 255}, {255, 128, 32}, {255, 255, 255} 1.8 +}; 1.9 + 1.10 +static const unsigned char pat[8] = { 1.11 + 0, 0, 0, 0, /* 0 0 0 0 0 0 0 0 */ 1.12 + 1, 0x11, 0x11, 0x11, /* 0 1 1 1 1 1 1 1 */ 1.13 + 1, 0x11, 0x11, 0x11, /* 0 1 1 1 1 1 1 1 */ 1.14 + 1, 0x11, 0x11, 0x12, /* 0 1 1 1 1 1 1 2 */ 1.15 + 1, 0x11, 0x12, 0x22, /* 0 1 1 1 1 2 2 2 */ 1.16 + 1, 0x11, 0x22, 0x22, /* 0 1 1 1 2 2 2 2 */ 1.17 + 1, 0x11, 0x22, 0x22, /* 0 1 1 1 2 2 2 2 */ 1.18 + 1, 0x12, 0x22, 0x22 /* 0 1 1 2 2 2 2 2 */ 1.19 +}; 1.20 + 1.21 int main(void) 1.22 { 1.23 - VDP_SET_CRAM_ADDR(0); 1.24 - VDP_SET_CRAM_RGB24(64, 128, 255); 1.25 + unsigned char *tmap; 1.26 + 1.27 + vdp_init(); 1.28 + 1.29 + vdp_setpal(0, sizeof pal / sizeof *pal, (unsigned char*)pal); 1.30 VDP_SET_BGCOLOR(0, 0); 1.31 - /* enable display */ 1.32 - VDP_SET_REG(0, VDP_REG0_BASE); 1.33 - VDP_SET_REG(1, VDP_REG1_BASE | VDP_REG1_DISP_BIT); 1.34 + 1.35 + vdp_set_tilemap_slot(VDP_PLANE_A, 0); 1.36 + tmap = vdp_tilemap_ptr(VDP_PLANE_A); 1.37 + 1.38 + 1.39 return 0; 1.40 }