From feed83ebf0106238124e20bb3a727a40f7f27e4f Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Mon, 25 Feb 2013 17:33:26 -0500 Subject: [PATCH] StripAddress --- toolbox/mm.cpp | 25 +++++++++++++++++++++++++ toolbox/mm.h | 2 ++ toolbox/toolbox.cpp | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index 80c16b4..e654b28 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -553,4 +553,29 @@ namespace MM return 0; } + + #pragma mark - + uint32_t StripAddress(uint16_t trap) + { + /* + * on entry: + * d0 Address to strip + * + * on exit: + * D0 Address that has been stripped. + * + */ + + // TODO -- in 32-bit mode, this is a nop. + // have a --24 / --32 flag? + + uint32_t address = cpuGetDReg(0); + + Log("%04x StripAddress(%08x)\n", trap, address); + + address &= 0x00ffffff; + return address; + } + + } \ No newline at end of file diff --git a/toolbox/mm.h b/toolbox/mm.h index b15d2d0..27d10e4 100644 --- a/toolbox/mm.h +++ b/toolbox/mm.h @@ -52,6 +52,8 @@ namespace MM uint16_t MoveHHi(uint16_t trap); + uint32_t StripAddress(uint16_t trap); + } diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index c4a38ea..1a25797 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -101,6 +101,10 @@ namespace ToolBox { d0 = MM::CompactMem(trap); break; + case 0xa055: + d0 = MM::StripAddress(trap); + break; + // MoveHHi (h: Handle); case 0xa064: d0 = MM::MoveHHi(trap);