megadrive_test2

changeset 6:df2c6b3c6f2e

added NTSC/PAL detection
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Jun 2017 06:32:10 +0300
parents ea70f3da150f
children 108ecc582a11
files src/io.h src/main.c
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/io.h	Wed Jun 21 06:32:10 2017 +0300
     1.3 @@ -0,0 +1,13 @@
     1.4 +#ifndef MEGADRIVE_IO_H_
     1.5 +#define MEGADRIVE_IO_H_
     1.6 +
     1.7 +#define IO_REG_VER	*((volatile uint8_t*)0xa10001)
     1.8 +
     1.9 +enum {
    1.10 +	IO_VER_VERSION_MASK = 0x0f,
    1.11 +	IO_VER_EXP		= 0x20,
    1.12 +	IO_VER_PAL		= 0x40,
    1.13 +	IO_VER_NONJP	= 0x80
    1.14 +};
    1.15 +
    1.16 +#endif	/* MEGADRIVE_IO_H_ */
     2.1 --- a/src/main.c	Tue Jun 20 06:08:58 2017 +0300
     2.2 +++ b/src/main.c	Wed Jun 21 06:32:10 2017 +0300
     2.3 @@ -1,5 +1,6 @@
     2.4  #include <stdint.h>
     2.5  #include "vdp.h"
     2.6 +#include "io.h"
     2.7  #include "tun_data.h"
     2.8  
     2.9  #define NAMETAB_A	6
    2.10 @@ -31,7 +32,9 @@
    2.11  
    2.12  	vdp_init();
    2.13  
    2.14 -	vdp_setreg(VDP_REG_MODE2, vdp_getreg(VDP_REG_MODE2) | VDP_MODE2_V30CELL);
    2.15 +	if(IO_REG_VER & IO_VER_PAL) {
    2.16 +		vdp_setreg(VDP_REG_MODE2, vdp_getreg(VDP_REG_MODE2) | VDP_MODE2_V30CELL);
    2.17 +	}
    2.18  
    2.19  	vdp_begin_palette(0, 0);
    2.20  	for(i=0; i<16; i++) {