From f53f286a8b48d19c65e83f90d00aa47e8e87c889 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 22 Dec 2007 20:25:17 +0000 Subject: [PATCH] SVP stubs git-svn-id: file:///home/notaz/opt/svn/PicoDrive@317 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Cart.c | 8 ++++++++ Pico/Memory.c | 14 ++++++++++---- Pico/MemoryCmn.c | 10 +++++----- Pico/PicoInt.h | 3 +++ Pico/carthw/carthw.h | 8 ++++++++ Pico/carthw/svp/Memory.c | 16 ++++++++++++++++ Pico/carthw/svp/svp.c | 7 +++++++ Pico/cd/Memory.c | 4 ++++ platform/linux/Makefile | 6 ++++-- platform/linux/gp2x.c | 1 + platform/linux/port_config.h | 4 +++- 11 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 Pico/carthw/carthw.h create mode 100644 Pico/carthw/svp/Memory.c create mode 100644 Pico/carthw/svp/svp.c diff --git a/Pico/Cart.c b/Pico/Cart.c index 749d461..34a497e 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 8dc11bb..f9d7f69 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 946125c..422ae2e 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 ed97081..b84ec1a 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 0000000..e066cac --- /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 0000000..0462d7f --- /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 0000000..a5de987 --- /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 c883a76..66719a8 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 870b1b3..66e44da 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 b89990b..4a7c556 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 9af5d3d..2f897b9 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...) -- 2.39.2