Skip to content

Commit

Permalink
SetOSTrap stub (Link patches _MaxBlock to return _MaxBlock - 2 before…
Browse files Browse the repository at this point in the history
… calling SetResLoad for some reason)
  • Loading branch information
ksherlock committed Feb 12, 2015
1 parent 67cb2b6 commit d48f3c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions toolbox/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions toolbox/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions toolbox/toolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d48f3c3

Please sign in to comment.