mirror of
https://github.com/ksherlock/mpw.git
synced 2024-12-22 15:29:45 +00:00
HandToHand (Pascal)
This commit is contained in:
parent
68a70cfcbc
commit
7f59b64aad
@ -999,6 +999,44 @@ namespace MM
|
||||
|
||||
#pragma mark - OS Utility Routines
|
||||
|
||||
|
||||
uint16_t HandToHand(uint16_t trap)
|
||||
{
|
||||
/*
|
||||
* on entry:
|
||||
* A0 source Handle
|
||||
*
|
||||
* on exit:
|
||||
* A0 destination Handle
|
||||
* D0 Result code
|
||||
*
|
||||
*/
|
||||
|
||||
uint32_t srcHandle = cpuGetAReg(0);
|
||||
|
||||
Log("%04x HandToHand(%08x)\n", trap, srcHandle);
|
||||
|
||||
auto iter = HandleMap.find(srcHandle);
|
||||
if (iter == HandleMap.end())
|
||||
return SetMemError(MacOS::memWZErr);
|
||||
|
||||
|
||||
auto const info = iter->second;
|
||||
|
||||
|
||||
uint32_t destHandle;
|
||||
uint32_t destPtr;
|
||||
uint32_t d0 = Native::NewHandle(info.size, false, destHandle, destPtr);
|
||||
if (d0 == 0)
|
||||
{
|
||||
std::memmove(memoryPointer(destPtr), memoryPointer(info.address), info.size);
|
||||
}
|
||||
|
||||
cpuSetAReg(0, destHandle);
|
||||
return d0; // SetMemError called by Native::NewHandle.
|
||||
}
|
||||
|
||||
|
||||
uint16_t PtrToHand(uint16_t trap)
|
||||
{
|
||||
/*
|
||||
@ -1030,6 +1068,9 @@ namespace MM
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
uint32_t StripAddress(uint16_t trap)
|
||||
{
|
||||
|
@ -200,6 +200,10 @@ namespace ToolBox {
|
||||
d0 = MM::MoveHHi(trap);
|
||||
break;
|
||||
|
||||
case 0xa9e1:
|
||||
d0 = MM::HandToHand(trap);
|
||||
break;
|
||||
|
||||
case 0xa9e3:
|
||||
d0 = MM::PtrToHand(trap);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user