32x: some missed code from MAME, minor tweaks

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@784 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-09-18 15:18:10 +00:00
parent 266c6afa84
commit 3cf9570bac
2 changed files with 19 additions and 5 deletions

View file

@ -69,6 +69,12 @@ int sh2_execute(SH2 *sh2_, int cycles)
{ {
UINT32 opcode; UINT32 opcode;
if (sh2->delay)
{
opcode = RW(sh2->delay);
sh2->pc -= 2;
}
else
opcode = RW(sh2->pc); opcode = RW(sh2->pc);
sh2->delay = 0; sh2->delay = 0;

View file

@ -52,7 +52,7 @@ static int poll_undetect(struct poll_det *pd, int flag)
} }
// SH2 faking // SH2 faking
//#define FAKE_SH2 #define FAKE_SH2
int p32x_csum_faked; int p32x_csum_faked;
#ifdef FAKE_SH2 #ifdef FAKE_SH2
static const u16 comm_fakevals[] = { static const u16 comm_fakevals[] = {
@ -84,7 +84,7 @@ static u32 p32x_reg_read16(u32 a)
{ {
a &= 0x3e; a &= 0x3e;
#ifdef FAKE_SH2 #if 0
if ((a & 0x30) == 0x20) if ((a & 0x30) == 0x20)
return sh2_comm_faker(a); return sh2_comm_faker(a);
#else #else
@ -93,6 +93,11 @@ static u32 p32x_reg_read16(u32 a)
SekEndRun(16); SekEndRun(16);
} }
#endif #endif
#ifdef FAKE_SH2
// fake only slave for now
if (a == 0x24 || a == 0x26)
return sh2_comm_faker(a);
#endif
return Pico32x.regs[a / 2]; return Pico32x.regs[a / 2];
} }
@ -136,9 +141,11 @@ static void p32x_reg_write16(u32 a, u32 d)
return; return;
} }
if ((a & 0x30) == 0x20) { if ((a & 0x30) == 0x20 && r[a / 2] != d) {
r[a / 2] = d; r[a / 2] = d;
poll_undetect(&msh2_poll, P32XF_MSH2POLL); if (poll_undetect(&msh2_poll, P32XF_MSH2POLL))
// if SH2 is busy waiting, it needs to see the result ASAP
SekEndRun(16);
return; return;
} }
@ -460,6 +467,7 @@ out_16to8:
u32 pico32x_read16(u32 a) u32 pico32x_read16(u32 a)
{ {
u32 d = 0; u32 d = 0;
if (a < sizeof(Pico32xMem->sh2_rom_m)) if (a < sizeof(Pico32xMem->sh2_rom_m))
return *(u16 *)(Pico32xMem->sh2_rom_m + a); return *(u16 *)(Pico32xMem->sh2_rom_m + a);