From: notaz Date: Sun, 11 Aug 2013 20:49:01 +0000 (+0300) Subject: 32x: some timing hacks.. X-Git-Tag: v1.85~2^2~33 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a847c12e6a82869b7ff6f1742f53e0da1ad2db6;p=picodrive.git 32x: some timing hacks.. --- diff --git a/pico/32x/memory.c b/pico/32x/memory.c index f9374c47..c6f3a316 100644 --- a/pico/32x/memory.c +++ b/pico/32x/memory.c @@ -32,7 +32,7 @@ * sys reg 0004000-00040ff 1 1 * vdp reg 0004100-00041ff 5 5 * vdp pal 0004200-00043ff 5 5 - * rom 2000000-23fffff 6-15 + * cart 2000000-23fffff 6-15 * dram/fb 4000000-401ffff 5-12 1-3 * fb ovr 4020000-403ffff * sdram 6000000-603ffff 12 2 (cycles) @@ -1063,6 +1063,8 @@ static u32 sh2_read8_cs0(u32 a, SH2 *sh2) { u32 d = 0; + sh2_burn_cycles(sh2, 1*2); + // 0x3ff00 is veridied if ((a & 0x3ff00) == 0x4000) { d = p32x_sh2reg_read16(a, sh2); @@ -1116,6 +1118,8 @@ static u32 sh2_read16_cs0(u32 a, SH2 *sh2) { u32 d = 0; + sh2_burn_cycles(sh2, 1*2); + if ((a & 0x3ff00) == 0x4000) { d = p32x_sh2reg_read16(a, sh2); if (!(EL_LOGMASK & EL_PWM) && (a & 0x30) == 0x30) // hide PWM @@ -1206,6 +1210,15 @@ static void REGPARM(3) sh2_write8_sdram(u32 a, u32 d, SH2 *sh2) Pico32xMem->sdram[a1 ^ 1] = d; } +static void REGPARM(3) sh2_write8_sdram_wt(u32 a, u32 d, SH2 *sh2) +{ + // xmen sync hack.. + if (a < 0x26000200) + sh2_end_run(sh2, 32); + + sh2_write8_sdram(a, d, sh2); +} + static void REGPARM(3) sh2_write8_da(u32 a, u32 d, SH2 *sh2) { u32 a1 = a & 0xfff; @@ -1609,7 +1622,8 @@ void PicoMemSetup32x(void) // CS3 - SDRAM sh2_read8_map[0x06/2].addr = sh2_read8_map[0x26/2].addr = sh2_read16_map[0x06/2].addr = sh2_read16_map[0x26/2].addr = MAP_MEMORY(Pico32xMem->sdram); - sh2_write8_map[0x06/2] = sh2_write8_map[0x26/2] = sh2_write8_sdram; + sh2_write8_map[0x06/2] = sh2_write8_sdram; + sh2_write8_map[0x26/2] = sh2_write8_sdram_wt; sh2_write16_map[0x06/2] = sh2_write16_map[0x26/2] = sh2_write16_sdram; sh2_read8_map[0x06/2].mask = sh2_read8_map[0x26/2].mask = sh2_read16_map[0x06/2].mask = sh2_read16_map[0x26/2].mask = 0x03ffff; diff --git a/pico/pico_int.h b/pico/pico_int.h index d6365799..2a793e5e 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -251,6 +251,7 @@ extern SH2 sh2s[2]; } \ } while (0) # define sh2_cycles_left(sh2) (sh2)->icount +# define sh2_burn_cycles(sh2, n) (sh2)->icount -= n # define sh2_pc(sh2) (sh2)->ppc #else # define sh2_end_run(sh2, after_) do { \ @@ -262,6 +263,7 @@ extern SH2 sh2s[2]; } \ } while (0) # define sh2_cycles_left(sh2) ((signed int)(sh2)->sr >> 12) +# define sh2_burn_cycles(sh2, n) (sh2)->sr -= ((n) << 12) # define sh2_pc(sh2) (sh2)->pc #endif