summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2011-01-23 06:14:19 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2011-01-23 06:14:19 +0000
commitada01108c53ceeccdaf7b5f046ff04c47849a31f (patch)
tree1361218e4f95aec71f7d32bdde024c19ff7167fa
parent410a8d8f2dfb27dac0c277108b65caed32f3e358 (diff)
Add SHOW_AARON_BUG as threatened (no whatsnew)
Instructions: - Enable SHOW_AARON_BUG and compile - Run any Naomi game with -debug (e.g. toyfight) - Step to the MOV.L at 00000018 - Thrill to an aligned 32-bit write causing 2 incorrect writes to a 32-bit handler, complete with wrong offset. The memory system appears to think the 32-bit handler is a 16-bit handler or something.
-rw-r--r--src/emu/cpu/sh4/sh4.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c
index fa7c6fc068c..9c479a87bfb 100644
--- a/src/emu/cpu/sh4/sh4.c
+++ b/src/emu/cpu/sh4/sh4.c
@@ -28,6 +28,8 @@
#include "sh4regs.h"
#include "sh4comn.h"
+//#define SHOW_AARON_BUG
+
#ifndef USE_SH4DRC
CPU_DISASSEMBLE( sh4 );
@@ -150,12 +152,13 @@ INLINE UINT32 RL(sh4_state *sh4, offs_t A)
INLINE void WB(sh4_state *sh4, offs_t A, UINT8 V)
{
-
+ #ifndef SHOW_AARON_BUG
if (A >= 0xfe000000)
{
sh4_internal_w(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 3)*8), 0xff << ((A & 3)*8));
return;
}
+ #endif
if (A >= 0xe0000000)
{
@@ -168,11 +171,13 @@ INLINE void WB(sh4_state *sh4, offs_t A, UINT8 V)
INLINE void WW(sh4_state *sh4, offs_t A, UINT16 V)
{
+ #ifndef SHOW_AARON_BUG
if (A >= 0xfe000000)
{
sh4_internal_w(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 2)*8), 0xffff << ((A & 2)*8));
return;
}
+ #endif
if (A >= 0xe0000000)
{
@@ -185,11 +190,13 @@ INLINE void WW(sh4_state *sh4, offs_t A, UINT16 V)
INLINE void WL(sh4_state *sh4, offs_t A, UINT32 V)
{
+ #ifndef SHOW_AARON_BUG
if (A >= 0xfe000000)
{
sh4_internal_w(sh4->internal, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V, 0xffffffff);
return;
}
+ #endif
if (A >= 0xe0000000)
{
@@ -3609,12 +3616,22 @@ static ADDRESS_MAP_START( sh4_internal_map, ADDRESS_SPACE_PROGRAM, 64 )
ADDRESS_MAP_END
#endif
+#ifdef SHOW_AARON_BUG
+static WRITE32_HANDLER(sh4_test_w)
+{
+ printf("offset = %08x, data = %08x, mask = %08x\n", offset, data, mem_mask);
+}
+#endif
+
/*When OC index mode is on (CCR.OIX = 1)*/
static ADDRESS_MAP_START( sh4_internal_map, ADDRESS_SPACE_PROGRAM, 64 )
AM_RANGE(0x1C000000, 0x1C000FFF) AM_RAM AM_MIRROR(0x01FFF000)
AM_RANGE(0x1E000000, 0x1E000FFF) AM_RAM AM_MIRROR(0x01FFF000)
AM_RANGE(0xE0000000, 0xE000003F) AM_RAM AM_MIRROR(0x03FFFFC0) // todo: store queues should be write only on DC's SH4, executing PREFM shouldn't cause an actual memory read access!
AM_RANGE(0xF6000000, 0xF7FFFFFF) AM_READWRITE(sh4_tlb_r,sh4_tlb_w)
+#ifdef SHOW_AARON_BUG
+ AM_RANGE(0xFE000000, 0xFFFFFFFF) AM_WRITE32(sh4_test_w, U64(0xffffffffffffffff))
+#endif
ADDRESS_MAP_END