added 12-in-1 mapper to carthw

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@369 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-03-05 18:50:28 +00:00
parent 48df6e9e54
commit 757f8dae1a
7 changed files with 87 additions and 22 deletions

View file

@ -640,20 +640,29 @@ void PicoCartDetect(void)
SRam.eeprom_bit_out= 7;
}
// 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 ||
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;
}

View file

@ -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;
}

52
Pico/carthw/carthw.c Normal file
View file

@ -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;
}

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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: