From d48f3c39da631f331cad48787d88be957389445a Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Wed, 11 Feb 2015 19:46:33 -0500 Subject: [PATCH] SetOSTrap stub (Link patches _MaxBlock to return _MaxBlock - 2 before calling SetResLoad for some reason) --- toolbox/os.cpp | 25 +++++++++++++++++++++++++ toolbox/os.h | 1 + toolbox/toolbox.cpp | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/toolbox/os.cpp b/toolbox/os.cpp index cca50d5..ffb540a 100644 --- a/toolbox/os.cpp +++ b/toolbox/os.cpp @@ -1026,6 +1026,31 @@ namespace OS return MacOS::dsCoreErr; } + uint16_t SetOSTrapAddress(uint16_t trap) + { + //pascal void SetOSTrapAddress(long trapAddr, short trapNum); + + /* + * on entry: + * A0 Address of patch + * D0 trap number + * + * on exit: + * + */ + + uint16_t trapNumber = cpuGetDReg(0); + uint32_t trapAddress = cpuGetAReg(0); + const char *trapName = TrapName(trapNumber | 0xa000); + if (!trapName) trapName = "Unknown"; + + Log("%04x SetOSTrapAddress($%08x, $%04x %s)\n", + trap, trapAddress, trapNumber, trapName); + + + return MacOS::dsCoreErr; + } + #pragma mark XP - RAM diff --git a/toolbox/os.h b/toolbox/os.h index 5b2520e..088e5aa 100644 --- a/toolbox/os.h +++ b/toolbox/os.h @@ -91,6 +91,7 @@ namespace OS uint16_t SetToolTrapAddress(uint16_t trap); uint16_t GetOSTrapAddress(uint16_t trap); + uint16_t SetOSTrapAddress(uint16_t trap); #pragma mark - Alias Manager diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index b763772..3a810fb 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -222,6 +222,10 @@ namespace ToolBox { d0 = OS::GetOSTrapAddress(trap); break; + case 0xa247: + d0 = OS::SetOSTrapAddress(trap); + break; + case 0xA823: d0 = OS::AliasDispatch(trap); break;