# HG changeset patch # User John Tsiombikas # Date 1498015930 -10800 # Node ID df2c6b3c6f2ed7157737688896bd5261ee0b06ac # Parent ea70f3da150fd983ee6f12c57573732367de3bec added NTSC/PAL detection diff -r ea70f3da150f -r df2c6b3c6f2e src/io.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/io.h Wed Jun 21 06:32:10 2017 +0300 @@ -0,0 +1,13 @@ +#ifndef MEGADRIVE_IO_H_ +#define MEGADRIVE_IO_H_ + +#define IO_REG_VER *((volatile uint8_t*)0xa10001) + +enum { + IO_VER_VERSION_MASK = 0x0f, + IO_VER_EXP = 0x20, + IO_VER_PAL = 0x40, + IO_VER_NONJP = 0x80 +}; + +#endif /* MEGADRIVE_IO_H_ */ diff -r ea70f3da150f -r df2c6b3c6f2e src/main.c --- a/src/main.c Tue Jun 20 06:08:58 2017 +0300 +++ b/src/main.c Wed Jun 21 06:32:10 2017 +0300 @@ -1,5 +1,6 @@ #include #include "vdp.h" +#include "io.h" #include "tun_data.h" #define NAMETAB_A 6 @@ -31,7 +32,9 @@ vdp_init(); - vdp_setreg(VDP_REG_MODE2, vdp_getreg(VDP_REG_MODE2) | VDP_MODE2_V30CELL); + if(IO_REG_VER & IO_VER_PAL) { + vdp_setreg(VDP_REG_MODE2, vdp_getreg(VDP_REG_MODE2) | VDP_MODE2_V30CELL); + } vdp_begin_palette(0, 0); for(i=0; i<16; i++) {