From 061c025e02f615fd62d991638bf649ec8265479e Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 4 Aug 2013 14:34:34 -0400 Subject: [PATCH] SetToolTrapAddress --- toolbox/os.cpp | 26 ++++++++++++++++++++++++++ toolbox/os.h | 2 ++ toolbox/toolbox.cpp | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/toolbox/os.cpp b/toolbox/os.cpp index 3c00e57..227fc47 100644 --- a/toolbox/os.cpp +++ b/toolbox/os.cpp @@ -1109,6 +1109,32 @@ namespace OS return MacOS::dsCoreErr; } + uint16_t SetToolTrapAddress(uint16_t trap) + { + //pascal void SetToolTrapAddress(long trapAddr, short trapNum); + + /* + * on entry: + * A0 Address of patch + * D0 trap number + * + * on exit: + * + */ + + // this is used by the far model stub, presumably + // to replace LoadSeg. + + uint16_t trapNumber = cpuGetDReg(0); + uint32_t trapAddress = cpuGetAReg(0); + + Log("%04x SetToolTrapAddress($%08x, $%04x)\n", + trap, trapAddress, trapNumber); + + + return MacOS::dsCoreErr; + } + uint16_t GetOSTrapAddress(uint16_t trap) { /* diff --git a/toolbox/os.h b/toolbox/os.h index 2579fb0..98a08e6 100644 --- a/toolbox/os.h +++ b/toolbox/os.h @@ -81,6 +81,8 @@ namespace OS #pragma mark - Trap Manager uint16_t GetToolTrapAddress(uint16_t trap); + uint16_t SetToolTrapAddress(uint16_t trap); + uint16_t GetOSTrapAddress(uint16_t trap); #pragma mark - Alias Manager diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index 1c44c33..c61d0db 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -148,6 +148,10 @@ namespace ToolBox { d0 = OS::GetToolTrapAddress(trap); break; + case 0xa647: + d0 = OS::SetToolTrapAddress(trap); + break; + case 0xA346: d0 = OS::GetOSTrapAddress(trap); break;