From: notaz Date: Sat, 22 Dec 2007 20:25:17 +0000 (+0000) Subject: SVP stubs X-Git-Tag: v1.85~605 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f53f286a8b48d19c65e83f90d00aa47e8e87c889;p=picodrive.git SVP stubs git-svn-id: file:///home/notaz/opt/svn/PicoDrive@317 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Cart.c b/Pico/Cart.c index 749d4614..34a497ea 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -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; + } } diff --git a/Pico/Memory.c b/Pico/Memory.c index 8dc11bb5..f9d7f69f 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -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; diff --git a/Pico/MemoryCmn.c b/Pico/MemoryCmn.c index 946125c1..422ae2ec 100644 --- a/Pico/MemoryCmn.c +++ b/Pico/MemoryCmn.c @@ -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); } diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index ed97081f..b84ec1ac 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -13,6 +13,7 @@ #include #include #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); diff --git a/Pico/carthw/carthw.h b/Pico/carthw/carthw.h new file mode 100644 index 00000000..e066cac6 --- /dev/null +++ b/Pico/carthw/carthw.h @@ -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); + diff --git a/Pico/carthw/svp/Memory.c b/Pico/carthw/svp/Memory.c new file mode 100644 index 00000000..0462d7fc --- /dev/null +++ b/Pico/carthw/svp/Memory.c @@ -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); +} + diff --git a/Pico/carthw/svp/svp.c b/Pico/carthw/svp/svp.c new file mode 100644 index 00000000..a5de987a --- /dev/null +++ b/Pico/carthw/svp/svp.c @@ -0,0 +1,7 @@ +#include "../../PicoInt.h" + +void PicoSVPInit(void) +{ + elprintf(0xffff, "SVP"); +} + diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index c883a768..66719a8c 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -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; diff --git a/platform/linux/Makefile b/platform/linux/Makefile index 870b1b39..66e44da6 100644 --- a/platform/linux/Makefile +++ b/platform/linux/Makefile @@ -43,6 +43,8 @@ OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \ Pico/cd/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.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 # 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 @@ -74,8 +76,8 @@ endif endif vpath %.c = ../.. -DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/sound zlib unzip \ - cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80 +DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/sound Pico/carthw/svp \ + zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80 all: mkdirs PicoDrive clean: tidy diff --git a/platform/linux/gp2x.c b/platform/linux/gp2x.c index b89990bc..4a7c5564 100644 --- a/platform/linux/gp2x.c +++ b/platform/linux/gp2x.c @@ -30,6 +30,7 @@ static const char *verstring = "PicoDrive " VERSION; // dummies char *ext_menu = 0, *ext_state = 0; +int mix_32_to_16l_level; /* gtk */ struct gtk_global_struct diff --git a/platform/linux/port_config.h b/platform/linux/port_config.h index 9af5d3d2..2f897b92 100644 --- a/platform/linux/port_config.h +++ b/platform/linux/port_config.h @@ -12,7 +12,9 @@ // pico.c #define CAN_HANDLE_240_LINES 1 -#define EL_LOGMASK (EL_ANOMALY|EL_STATUS|EL_SRAMIO|EL_EEPROM) // EL_VDPDMA|EL_ASVDP|EL_SR) // |EL_BUSREQ|EL_Z80BNK) +#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo + +#define EL_LOGMASK (EL_ANOMALY|EL_STATUS|EL_SRAMIO|EL_EEPROM|EL_UIO) // EL_VDPDMA|EL_ASVDP|EL_SR) // |EL_BUSREQ|EL_Z80BNK) //#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) #define dprintf(x...)