From: notaz Date: Wed, 5 Mar 2008 18:50:28 +0000 (+0000) Subject: added 12-in-1 mapper to carthw X-Git-Tag: v1.85~562 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=757f8dae1a2e71eb299cfb82269a1b1507da63bf;p=picodrive.git added 12-in-1 mapper to carthw git-svn-id: file:///home/notaz/opt/svn/PicoDrive@369 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Cart.c b/Pico/Cart.c index 5e01e9ac..6eb7fc7a 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -640,20 +640,29 @@ void PicoCartDetect(void) SRam.eeprom_bit_out= 7; } + // SVP detection + else if (name_cmp("Virtua Racing") == 0 || + name_cmp("VIRTUA RACING") == 0) + { + PicoSVPStartup(); + } + + // Detect 4-in-1 and 12-in-1 + else if ((name_cmp("ROBOCOP 3") && Pico.romsize == 0x200000) || + (rom_strcmp(0x160, "FLICKY") && Pico.romsize == 0x200000)) + { + carthw_12in1_startup(); + } + // Some games malfunction if SRAM is not filled with 0xff if (name_cmp("DINO DINI'S SOCCER") == 0 || name_cmp("MICRO MACHINES II") == 0) + { memset(SRam.data, 0xff, sram_size); + } // Unusual region 'code' if (rom_strcmp(0x1f0, "EUROPE") == 0) *(int *) (Pico.rom+0x1f0) = 0x20204520; - - // SVP detection - if (name_cmp("Virtua Racing") == 0 || - name_cmp("VIRTUA RACING") == 0) - { - PicoSVPStartup(); - } } diff --git a/Pico/Memory.c b/Pico/Memory.c index 847d1bd0..8632c7a7 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -303,19 +303,8 @@ static void OtherWrite8End(u32 a,u32 d,int realsize) #endif elprintf(EL_UIO, "strange w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc); - if(a >= 0xA13004 && a < 0xA13040) { - // dumb 12-in-1 or 4-in-1 banking support - int len; - a &= 0x3f; a <<= 16; - len = Pico.romsize - a; - if (len <= 0) return; // invalid/missing bank - if (len > 0x200000) len = 0x200000; // 2 megs - memcpy(Pico.rom, Pico.rom+a, len); // code which does this is in RAM so this is safe. - return; - } - // for games with simple protection devices, discovered by Haze - else if ((a>>22) == 1) + if ((a>>22) == 1) Pico.m.prot_bytes[(a>>2)&1] = (u8)d; } diff --git a/Pico/carthw/carthw.c b/Pico/carthw/carthw.c new file mode 100644 index 00000000..1e92e869 --- /dev/null +++ b/Pico/carthw/carthw.c @@ -0,0 +1,52 @@ +#include "../PicoInt.h" + +/* 12-in-1 */ +static unsigned int carthw_12in1_read16(unsigned int a, int realsize) +{ + // ?? + elprintf(EL_UIO, "12-in-1: read [%06x] @ %06x", a, SekPc); + return 0; +} + +static void carthw_12in1_write8(unsigned int a, unsigned int d, int realsize) +{ + int len; + + if (a < 0xA13000 || a >= 0xA13040) { + elprintf(EL_ANOMALY, "12-in-1: unexpected write [%06x] %02x @ %06x", a, d, SekPc); + } + + a &= 0x3f; a <<= 16; + len = Pico.romsize - a; + if (len <= 0) { + elprintf(EL_ANOMALY, "12-in-1: missing bank @ %06x", a); + return; + } + + memcpy(Pico.rom, Pico.rom + 0x200000 + a, len); +} + +static void carthw_12in1_reset(void) +{ + carthw_12in1_write8(0xA13000, 0, 0); +} + +void carthw_12in1_startup(void) +{ + void *tmp; + + elprintf(EL_STATUS, "12-in-1 mapper detected"); + + tmp = realloc(Pico.rom, 0x200000 + 0x200000); + if (tmp == NULL) + { + elprintf(EL_STATUS, "OOM"); + return; + } + memcpy(Pico.rom + 0x200000, Pico.rom, 0x200000); + + PicoRead16Hook = carthw_12in1_read16; + PicoWrite8Hook = carthw_12in1_write8; + PicoResetHook = carthw_12in1_reset; +} + diff --git a/Pico/carthw/carthw.h b/Pico/carthw/carthw.h index e940d580..31381682 100644 --- a/Pico/carthw/carthw.h +++ b/Pico/carthw/carthw.h @@ -17,3 +17,6 @@ unsigned int PicoSVPRead16(unsigned int a, int realsize); void PicoSVPWrite8 (unsigned int a, unsigned int d, int realsize); void PicoSVPWrite16(unsigned int a, unsigned int d, int realsize); +/* 12-in-1 */ +void carthw_12in1_startup(void); + diff --git a/platform/linux/Makefile b/platform/linux/Makefile index fd37478a..50756369 100644 --- a/platform/linux/Makefile +++ b/platform/linux/Makefile @@ -44,7 +44,8 @@ OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \ # Pico - sound OBJS += Pico/sound/sound.o Pico/sound/sn76496.o Pico/sound/ym2612.o Pico/sound/mix.o # Pico - carthw -OBJS += Pico/carthw/svp/svp.o Pico/carthw/svp/Memory.o Pico/carthw/svp/ssp16.o Pico/carthw/svp/compiler.o +OBJS += Pico/carthw/carthw.o Pico/carthw/svp/svp.o Pico/carthw/svp/Memory.o \ + Pico/carthw/svp/ssp16.o Pico/carthw/svp/compiler.o # zlib OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o diff --git a/platform/win32/GenaDrive/Main.cpp b/platform/win32/GenaDrive/Main.cpp index 724c454e..87c2be9b 100644 --- a/platform/win32/GenaDrive/Main.cpp +++ b/platform/win32/GenaDrive/Main.cpp @@ -122,7 +122,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) "NJ: CZ80\n" "MAME devs: YM2612 and SN76496 cores\n" "Stéphane Dallongeville: Gens code, base of Fame/C (C68K), CZ80\n" - "Tasco Deluxe: SVP RE work\n", + "Tasco Deluxe: SVP RE work\n" + "Pierpaolo Prazzoli: info about SSP16 chips\n", "About", 0); return 0; } diff --git a/platform/win32/GenaDrive/readme.txt b/platform/win32/GenaDrive/readme.txt index ca880568..4153273a 100644 --- a/platform/win32/GenaDrive/readme.txt +++ b/platform/win32/GenaDrive/readme.txt @@ -14,6 +14,14 @@ and the likes, as this emu was not meant to compete with them. For more info, visit http://notaz.gp2x.de/svp.php +Releases +-------- + +1.40 - first release. +1.40a - Tasco Deluxe's dithering fix. +1.40b - Perspective fix thanks to Pierpaolo Prazzoli's info. + + Controls -------- @@ -32,7 +40,9 @@ Credits ------- A lot of work on making SVP emulation happen was done by Tasco Deluxe, my -stuff is a continuation of his. +stuff is a continuation of his. Pierpaolo Prazzoli's information and his +SSP1610 disassebler in MAME code helped a lot too. + The original PicoDrive was written by fDave from finalburn.com This PicoDrive version uses bits and pieces of from other projects: