megadrive_test2

diff src/debug.c @ 10:ca7108a82867

fixed gamepad input on real megadrive
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 24 Jun 2017 02:33:52 +0300
parents 403367d5df5a
children
line diff
     1.1 --- a/src/debug.c	Sat Jun 24 00:33:10 2017 +0300
     1.2 +++ b/src/debug.c	Sat Jun 24 02:33:52 2017 +0300
     1.3 @@ -1,17 +1,29 @@
     1.4  #include "debug.h"
     1.5  #include "dbgfont.h"
     1.6 +#include "vdp.h"
     1.7  
     1.8 -static int init_done;
     1.9 +static uint16_t dbgpal[] = {
    1.10 +	VDP_PACK_RGB(0, 0, 0), VDP_PACK_RGB(7, 0, 0),
    1.11 +	VDP_PACK_RGB(0, 7, 0), VDP_PACK_RGB(0, 0, 7),
    1.12 +	VDP_PACK_RGB(7, 7, 0), VDP_PACK_RGB(7, 0, 7),
    1.13 +	VDP_PACK_RGB(0, 7, 7), VDP_PACK_RGB(7, 7, 7),
    1.14 +	VDP_PACK_RGB(0, 0, 0), VDP_PACK_RGB(3, 0, 0),
    1.15 +	VDP_PACK_RGB(0, 3, 0), VDP_PACK_RGB(0, 0, 3),
    1.16 +	VDP_PACK_RGB(3, 3, 0), VDP_PACK_RGB(3, 0, 3),
    1.17 +	VDP_PACK_RGB(0, 3, 3), VDP_PACK_RGB(3, 3, 3)
    1.18 +};
    1.19  
    1.20 -static void init_font(void)
    1.21 +void dbg_init(void)
    1.22  {
    1.23 +	int i;
    1.24  	/* TODO allocate tiles, prepare palette etc */
    1.25 +
    1.26 +	vdp_begin_palette(DBG_PALIDX, 0);
    1.27 +	for(i=0; i<16; i++) {
    1.28 +		VDP_PORT_DATA = dbgpal[i];
    1.29 +	}
    1.30  }
    1.31  
    1.32  void dbg_print(const char *s)
    1.33  {
    1.34 -	if(!init_done) {
    1.35 -		init_font();
    1.36 -		init_done = 1;
    1.37 -	}
    1.38  }