dualcore integration in famc, bram cart C code, psp bugfixes

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@294 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-11-11 15:38:27 +00:00
parent 4b167c12c7
commit 8022f53da6
15 changed files with 160 additions and 42 deletions

View file

@ -41,7 +41,7 @@ static int otherRun(void)
CycloneRun(&PicoCpuCM68k);
return 1-PicoCpuCM68k.cycles;
#elif defined(EMU_F68K)
return fm68k_emulate(1);
return fm68k_emulate(1, 0);
#endif
}

View file

@ -213,7 +213,7 @@ static __inline void SekRunM68k(int cyc)
#elif defined(EMU_M68K)
SekCycleCnt+=m68k_execute(cyc_do);
#elif defined(EMU_F68K)
SekCycleCnt+=fm68k_emulate(cyc_do+1);
SekCycleCnt+=fm68k_emulate(cyc_do+1, 0);
#endif
}
@ -230,7 +230,7 @@ static __inline void SekStep(void)
#elif defined(EMU_M68K)
SekCycleCnt+=m68k_execute(1);
#elif defined(EMU_F68K)
SekCycleCnt+=fm68k_emulate(1);
SekCycleCnt+=fm68k_emulate(1, 0);
#endif
SekCycleAim=realaim;
}

View file

@ -392,6 +392,24 @@ static u32 OtherRead16End(u32 a, int realsize)
goto end;
}
if (a==0x400000) {
if (SRam.data != NULL) d=3; // 64k cart
goto end;
}
if ((a&0xfe0000)==0x600000) {
if (SRam.data != NULL) {
d=SRam.data[((a>>1)&0xffff)+0x2000];
if (realsize == 8) d|=d<<8;
}
goto end;
}
if (a==0x7ffffe) {
d=Pico_mcd->m.bcram_reg;
goto end;
}
dprintf("m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);
end:
@ -403,6 +421,19 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
{
if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; }
if ((a&0xfe0000)==0x600000) {
if (SRam.data != NULL && (Pico_mcd->m.bcram_reg&1)) {
SRam.data[((a>>1)&0xffff)+0x2000]=d;
SRam.changed = 1;
}
return;
}
if (a==0x7fffff) {
Pico_mcd->m.bcram_reg=d;
return;
}
dprintf("m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);
}

View file

@ -381,7 +381,7 @@ PicoWriteS68k32: @ u32 a, u32 d
add r2, r2, #0x110000
add r2, r2, #0x002200
.if \is_read
ldrb r0, [r2, #0x18]
ldrb r0, [r2, #0x18] @ Pico_mcd->m.bcram_reg
.else
strb r1, [r2, #0x18]
.endif

View file

@ -99,7 +99,7 @@ static __inline void SekRunM68k(int cyc)
SekCycleCnt+=m68k_execute(cyc_do);
#elif defined(EMU_F68K)
g_m68kcontext=&PicoCpuFM68k;
SekCycleCnt+=fm68k_emulate(cyc_do);
SekCycleCnt+=fm68k_emulate(cyc_do, 0);
#endif
}
@ -119,15 +119,22 @@ static __inline void SekRunS68k(int cyc)
SekCycleCntS68k+=m68k_execute(cyc_do);
#elif defined(EMU_F68K)
g_m68kcontext=&PicoCpuFS68k;
SekCycleCntS68k+=fm68k_emulate(cyc_do);
SekCycleCntS68k+=fm68k_emulate(cyc_do, 0);
#endif
}
#define PS_STEP_M68K ((488<<16)/20) // ~24
//#define PS_STEP_S68K 13
#ifdef _ASM_CD_PICO_C
void SekRunPS(int cyc_m68k, int cyc_s68k);
#if defined(_ASM_CD_PICO_C)
extern void SekRunPS(int cyc_m68k, int cyc_s68k);
#elif defined(EMU_F68K)
static __inline void SekRunPS(int cyc_m68k, int cyc_s68k)
{
SekCycleAim+=cyc_m68k;
SekCycleAimS68k+=cyc_s68k;
fm68k_emulate(0, 1);
}
#else
static __inline void SekRunPS(int cyc_m68k, int cyc_s68k)
{
@ -152,7 +159,7 @@ static __inline void SekRunPS(int cyc_m68k, int cyc_s68k)
SekCycleCnt += m68k_execute(cyc_do);
#elif defined(EMU_F68K)
g_m68kcontext = &PicoCpuFM68k;
SekCycleCnt += fm68k_emulate(cyc_do);
SekCycleCnt += fm68k_emulate(cyc_do, 0);
#endif
}
if ((cyc_do = SekCycleAimS68k-SekCycleCntS68k-cycn_s68k) > 0) {
@ -165,7 +172,7 @@ static __inline void SekRunPS(int cyc_m68k, int cyc_s68k)
SekCycleCntS68k += m68k_execute(cyc_do);
#elif defined(EMU_F68K)
g_m68kcontext = &PicoCpuFS68k;
SekCycleCntS68k += fm68k_emulate(cyc_do);
SekCycleCntS68k += fm68k_emulate(cyc_do, 0);
#endif
}
}

View file

@ -3,8 +3,6 @@
#include "../PicoInt.h"
//#include <stdlib.h>
int PicoCDBuffers = 0;
static unsigned char *cd_buffer = NULL;
static int prev_lba = 0x80000000;
@ -27,7 +25,7 @@ void PicoCDBufferInit(void)
/* try alloc'ing until we succeed */
while (PicoCDBuffers > 0)
{
tmp = realloc(cd_buffer, PicoCDBuffers * 2048);
tmp = realloc(cd_buffer, PicoCDBuffers * 2048 + 304);
if (tmp != NULL) break;
PicoCDBuffers >>= 1;
}
@ -104,11 +102,18 @@ PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba)
if (is_bin)
{
int i;
for (i = 0; i < read_len; i++)
int i = 0;
#if REDUCE_IO_CALLS
int bufs = (read_len*2048+304) / (2048+304);
pm_read(cd_buffer, bufs*(2048+304), Pico_mcd->TOC.Tracks[0].F);
for (i = 1; i < bufs; i++)
// should really use memmove here, but my memcpy32 implementation is also suitable here
memcpy32((int *)(cd_buffer + i*2048), (int *)(cd_buffer + i*(2048+304)), 2048/4);
#endif
for (; i < read_len; i++)
{
pm_read(cd_buffer + i*2048, 2048, Pico_mcd->TOC.Tracks[0].F);
pm_seek(Pico_mcd->TOC.Tracks[0].F, 304, SEEK_CUR);
pm_read(cd_buffer + i*2048, 2048 + 304, Pico_mcd->TOC.Tracks[0].F);
// pm_seek(Pico_mcd->TOC.Tracks[0].F, 304, SEEK_CUR); // seeking is slower, in PSP case even more
}
}
else