GetOS/ToolTrapAddress (MPW 3.2 InitEnv)

This commit is contained in:
Kelvin Sherlock 2013-05-16 22:39:52 -04:00
parent c6e4867c25
commit 2fb4e67323
3 changed files with 54 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include <cpu/fmem.h>
#include <macos/sysequ.h>
#include <macos/errors.h>
#include "os.h"
#include "os_internal.h"
@ -1002,4 +1003,42 @@ namespace OS
}
#pragma mark - Trap Manager
uint16_t GetToolTrapAddress(uint16_t trap)
{
/*
* on entry:
* D0 trap number
*
* on exit:
* A0 Address of patch
*
*/
uint16_t trapNumber = cpuGetDReg(0);
Log("%04x GetToolTrapAddress($%04x)\n", trap, trapNumber);
cpuSetAReg(0, 0);
return MacOS::dsCoreErr;
}
uint16_t GetOSTrapAddress(uint16_t trap)
{
/*
* on entry:
* D0 trap number
*
* on exit:
* A0 Address of patch
*
*/
uint16_t trapNumber = cpuGetDReg(0);
Log("%04x GetOSTrapAddress($%04x)\n", trap, trapNumber);
cpuSetAReg(0, 0);
return MacOS::dsCoreErr;
}
}

View File

@ -67,6 +67,11 @@ namespace OS
uint16_t HFSDispatch(uint16_t trap);
uint16_t HighLevelHFSDispatch(uint16_t trap);
#pragma mark - Trap Manager
uint16_t GetToolTrapAddress(uint16_t trap);
uint16_t GetOSTrapAddress(uint16_t trap);
}
#endif

View File

@ -89,6 +89,16 @@ namespace ToolBox {
d0 = OS::HighLevelHFSDispatch(trap);
break;
case 0xA746:
d0 = OS::GetToolTrapAddress(trap);
break;
case 0xA346:
d0 = OS::GetOSTrapAddress(trap);
break;
// SetPtrSize (p: Ptr; newSize: Size);
case 0xa020:
d0 = MM::SetPtrSize(trap);