SVP stubs

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@317 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-12-22 20:25:17 +00:00
parent 0ce6e5ee0a
commit f53f286a8b
11 changed files with 69 additions and 12 deletions

View file

@ -632,5 +632,13 @@ void PicoCartDetect(void)
// Unusual region 'code'
if (rom_strcmp(0x1f0, "EUROPE") == 0)
*(int *) (Pico.rom+0x1f0) = 0x20204520;
// SVP detection
if (name_cmp("Virtua Racing") == 0)
{
PicoSVPInit();
PicoRead16Hook = PicoSVPRead16;
PicoWrite8Hook = PicoSVPWrite8;
}
}

View file

@ -203,10 +203,7 @@ static void SRAMWrite(u32 a, u32 d)
}
// for nonstandard reads
#ifndef _ASM_MEMORY_C
static
#endif
u32 OtherRead16End(u32 a, int realsize)
static u32 OtherRead16End(u32 a, int realsize)
{
u32 d=0;
@ -499,8 +496,17 @@ static void PicoWrite32(u32 a,u32 d)
// -----------------------------------------------------------------
// TODO: asm code
u32 (*PicoRead16Hook)(u32 a, int realsize) = OtherRead16End;
void (*PicoWrite8Hook)(u32 a, u32 d, int realsize) = OtherWrite8End;
PICO_INTERNAL void PicoMemSetup(void)
{
// default unmapped/cart specific handlers
PicoRead16Hook = OtherRead16End;
PicoWrite8Hook = OtherWrite8End;
// Setup memory callbacks:
#ifdef EMU_C68K
PicoCpuCM68k.checkpc=PicoCheckPc;

View file

@ -136,7 +136,7 @@ u32 OtherRead16(u32 a, int realsize)
goto end;
}
d = OtherRead16End(a, realsize);
d = PicoRead16Hook(a, realsize);
end:
return d;
@ -191,7 +191,7 @@ void OtherWrite8(u32 a,u32 d)
return;
}
OtherWrite8End(a, d, 8);
PicoWrite8Hook(a, d, 8);
}
@ -227,10 +227,10 @@ void OtherWrite16(u32 a,u32 d)
SRAMWrite(a, d);
return;
}
#else
OtherWrite8End(a, d>>8, 16);
OtherWrite8End(a+1,d&0xff, 16);
#endif
PicoWrite8Hook(a, d>>8, 16);
PicoWrite8Hook(a+1,d&0xff, 16);
}

View file

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include "Pico.h"
#include "carthw/carthw.h"
//
#define USE_POLL_DETECT
@ -393,6 +394,8 @@ PICO_INTERNAL unsigned short z80_read16(unsigned short a);
#else
PICO_INTERNAL_ASM void z80_write(unsigned int a, unsigned char data);
#endif
extern unsigned int (*PicoRead16Hook)(unsigned int a, int realsize);
extern void (*PicoWrite8Hook)(unsigned int a,unsigned int d,int realsize);
// cd/Memory.c
PICO_INTERNAL void PicoMemSetupCD(void);

8
Pico/carthw/carthw.h Normal file
View file

@ -0,0 +1,8 @@
/* svp */
void PicoSVPInit(void);
unsigned int PicoSVPRead16(unsigned int a, int realsize);
void PicoSVPWrite8(unsigned int a,unsigned int d,int realsize);

16
Pico/carthw/svp/Memory.c Normal file
View file

@ -0,0 +1,16 @@
#include "../../PicoInt.h"
unsigned int PicoSVPRead16(unsigned int a, int realsize)
{
unsigned int d = 0;
elprintf(EL_UIO, "SVP r%i: [%06x] %04x @%06x", realsize, a&0xffffff, d, SekPc);
return d;
}
void PicoSVPWrite8(unsigned int a, unsigned int d, int realsize)
{
elprintf(EL_UIO, "SVP w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc);
}

7
Pico/carthw/svp/svp.c Normal file
View file

@ -0,0 +1,7 @@
#include "../../PicoInt.h"
void PicoSVPInit(void)
{
elprintf(0xffff, "SVP");
}

View file

@ -1626,6 +1626,10 @@ void PicoMemResetCD(int r3)
PICO_INTERNAL void PicoMemSetupCD(void)
{
// additional handlers for common code
PicoRead16Hook = OtherRead16End;
PicoWrite8Hook = OtherWrite8End;
#ifdef EMU_C68K
// Setup m68k memory callbacks:
PicoCpuCM68k.checkpc=PicoCheckPcM68k;