X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fmemory.c;h=5160df15bfe2d7d4552f592066bf411c461e3032;hb=5e49c3a88d1c3ece302a40d8c3a32285d3199ab6;hp=2eaac2affd97195cb571c44437f4f53681da2aa4;hpb=45f2f245f51ef0c0d37df3c998595c132bfcaffa;p=picodrive.git diff --git a/pico/memory.c b/pico/memory.c index 2eaac2a..5160df1 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -317,93 +317,6 @@ static void ctl_write_z80reset(u32 d) } } - -// for nonstandard reads -// TODO: mv to carthw -u32 OtherRead16End(u32 a, int realsize) -{ - u32 d=0; - - // 32x test -/* - if (a == 0xa130ec) { d = 0x4d41; goto end; } // MA - else if (a == 0xa130ee) { d = 0x5253; goto end; } // RS - else if (a == 0xa15100) { d = 0x0080; goto end; } - else -*/ - - // for games with simple protection devices, discovered by Haze - // some dumb detection is used, but that should be enough to make things work - if ((a>>22) == 1 && Pico.romsize >= 512*1024) { - if (*(int *)(Pico.rom+0x123e4) == 0x00550c39 && *(int *)(Pico.rom+0x123e8) == 0x00000040) { // Super Bubble Bobble (Unl) [!] - if (a == 0x400000) { d=0x55<<8; goto end; } - else if (a == 0x400002) { d=0x0f<<8; goto end; } - } - else if (*(int *)(Pico.rom+0x008c4) == 0x66240055 && *(int *)(Pico.rom+0x008c8) == 0x00404df9) { // Smart Mouse (Unl) - if (a == 0x400000) { d=0x55<<8; goto end; } - else if (a == 0x400002) { d=0x0f<<8; goto end; } - else if (a == 0x400004) { d=0xaa<<8; goto end; } - else if (a == 0x400006) { d=0xf0<<8; goto end; } - } - else if (*(int *)(Pico.rom+0x00404) == 0x00a90600 && *(int *)(Pico.rom+0x00408) == 0x6708b013) { // King of Fighters '98, The (Unl) [!] - if (a == 0x480000 || a == 0x4800e0 || a == 0x4824a0 || a == 0x488880) { d=0xaa<<8; goto end; } - else if (a == 0x4a8820) { d=0x0a<<8; goto end; } - // there is also a read @ 0x4F8820 which needs 0, but that is returned in default case - } - else if (*(int *)(Pico.rom+0x01b24) == 0x004013f9 && *(int *)(Pico.rom+0x01b28) == 0x00ff0000) { // Mahjong Lover (Unl) [!] - if (a == 0x400000) { d=0x90<<8; goto end; } - else if (a == 0x401000) { d=0xd3<<8; goto end; } // this one doesn't seem to be needed, the code does 2 comparisons and only then - // checks the result, which is of the above one. Left it just in case. - } - else if (*(int *)(Pico.rom+0x05254) == 0x0c3962d0 && *(int *)(Pico.rom+0x05258) == 0x00400055) { // Elf Wor (Unl) - if (a == 0x400000) { d=0x55<<8; goto end; } - else if (a == 0x400004) { d=0xc9<<8; goto end; } // this check is done if the above one fails - else if (a == 0x400002) { d=0x0f<<8; goto end; } - else if (a == 0x400006) { d=0x18<<8; goto end; } // similar to above - } - // our default behaviour is to return whatever was last written a 0x400000-0x7fffff range (used by Squirrel King (R) [!]) - // Lion King II, The (Unl) [!] writes @ 400000 and wants to get that val @ 400002 and wites another val - // @ 400004 which is expected @ 400006, so we really remember 2 values here -/// d = Pico.m.prot_bytes[(a>>2)&1]<<8; - } - else if (a == 0xa13000 && Pico.romsize >= 1024*1024) { - if (*(int *)(Pico.rom+0xc8af0) == 0x30133013 && *(int *)(Pico.rom+0xc8af4) == 0x000f0240) { // Rockman X3 (Unl) [!] - d=0x0c; goto end; - } - else if (*(int *)(Pico.rom+0x28888) == 0x07fc0000 && *(int *)(Pico.rom+0x2888c) == 0x4eb94e75) { // Bug's Life, A (Unl) [!] - d=0x28; goto end; // does the check from RAM - } - else if (*(int *)(Pico.rom+0xc8778) == 0x30133013 && *(int *)(Pico.rom+0xc877c) == 0x000f0240) { // Super Mario Bros. (Unl) [!] - d=0x0c; goto end; // seems to be the same code as in Rockman X3 (Unl) [!] - } - else if (*(int *)(Pico.rom+0xf20ec) == 0x30143013 && *(int *)(Pico.rom+0xf20f0) == 0x000f0200) { // Super Mario 2 1998 (Unl) [!] - d=0x0a; goto end; - } - } - else if (a == 0xa13002) { // Pocket Monsters (Unl) - d=0x01; goto end; - } - else if (a == 0xa1303E) { // Pocket Monsters (Unl) - d=0x1f; goto end; - } - else if (a == 0x30fe02) { - // Virtua Racing - just for fun - // this seems to be some flag that SVP is ready or something similar - d=1; goto end; - } - -end: - elprintf(EL_UIO, "strange r%i: [%06x] %04x @%06x", realsize, a&0xffffff, d, SekPc); - return d; -} - -void OtherWrite8End(u32 a,u32 d,int realsize) -{ - // for games with simple protection devices, discovered by Haze - if ((a>>22) == 1) -;/// Pico.m.prot_bytes[(a>>2)&1] = (u8)d; -} - // ----------------------------------------------------------------- // cart (save) RAM area (usually 0x200000 - ...) @@ -588,6 +501,11 @@ u32 PicoRead8_io(u32 a) goto end; } + if (!(PicoOpt & POPT_DIS_32X)) { + d = PicoRead8_32x(a); + goto end; + } + d = m68k_unmapped_read8(a); end: return d; @@ -616,6 +534,11 @@ u32 PicoRead16_io(u32 a) goto end; } + if (!(PicoOpt & POPT_DIS_32X)) { + d = PicoRead16_32x(a); + goto end; + } + d = m68k_unmapped_read16(a); end: return d; @@ -641,6 +564,11 @@ void PicoWrite8_io(u32 a, u32 d) Pico.m.sram_reg |= (u8)(d & 3); return; } + if (!(PicoOpt & POPT_DIS_32X)) { + PicoWrite8_32x(a, d); + return; + } + m68k_unmapped_write8(a, d); } @@ -664,6 +592,10 @@ void PicoWrite16_io(u32 a, u32 d) Pico.m.sram_reg |= (u8)(d & 3); return; } + if (!(PicoOpt & POPT_DIS_32X)) { + PicoWrite16_32x(a, d); + return; + } m68k_unmapped_write16(a, d); } @@ -1150,7 +1082,6 @@ static unsigned char MEMH_FUNC z80_md_vdp_read(unsigned short a) static unsigned char MEMH_FUNC z80_md_bank_read(unsigned short a) { - extern unsigned int PicoReadM68k8(unsigned int a); unsigned int addr68k; unsigned char ret; @@ -1192,7 +1123,6 @@ static void MEMH_FUNC z80_md_vdp_br_write(unsigned int a, unsigned char data) static void MEMH_FUNC z80_md_bank_write(unsigned int a, unsigned char data) { - extern void PicoWriteM68k8(unsigned int a, unsigned char d); unsigned int addr68k; addr68k = Pico.m.z80_bank68k << 15;