GetHandleSize, HPurge

This commit is contained in:
Kelvin Sherlock 2013-02-24 23:20:38 -05:00
parent 675170ae72
commit 5c00dc1ca5
3 changed files with 58 additions and 0 deletions

View File

@ -457,10 +457,58 @@ namespace MM
return Native::DisposeHandle(hh); return Native::DisposeHandle(hh);
} }
uint32_t GetHandleSize(uint16_t trap)
{
/*
* on entry:
* A0 handle
*
* on exit:
* D0 size (32-bit) or error code
*
*/
uint32_t hh = cpuGetAReg(0);
Log("%08x GetHandleSize(%08x,)\n", trap, hh);
auto iter = HandleMap.find(hh);
if (iter == HandleMap.end()) return SetMemError(memWZErr);
return iter->second.size;
}
#pragma mark Handle attributes #pragma mark Handle attributes
// these are all nops for now. // these are all nops for now.
uint16_t HPurge(uint16_t trap)
{
/*
* on entry:
* A0 Handle
*
* on exit:
* D0 Result code
*
*/
uint32_t hh = cpuGetAReg(0);
Log("%04x HPurge(%08x)\n", trap, hh);
auto iter = HandleMap.find(hh);
if (iter == HandleMap.end()) return SetMemError(memWZErr);
return 0;
}
uint16_t HLock(uint16_t trap) uint16_t HLock(uint16_t trap)
{ {
/* /*

View File

@ -48,6 +48,8 @@ namespace MM
uint16_t HLock(uint16_t trap); uint16_t HLock(uint16_t trap);
uint16_t HUnlock(uint16_t trap); uint16_t HUnlock(uint16_t trap);
uint16_t HPurge(uint16_t trap);
uint16_t MoveHHi(uint16_t trap); uint16_t MoveHHi(uint16_t trap);
} }

View File

@ -67,6 +67,10 @@ namespace ToolBox {
d0 = MM::DisposeHandle(trap); d0 = MM::DisposeHandle(trap);
break; break;
case 0xa025:
d0 = MM::GetHandleSize(trap);
break;
case 0xa029: case 0xa029:
d0 = MM::HLock(trap); d0 = MM::HLock(trap);
break; break;
@ -80,6 +84,10 @@ namespace ToolBox {
d0 = MM::BlockMove(trap); d0 = MM::BlockMove(trap);
break; break;
case 0xa049:
d0 = MM::HPurge(trap);
break;
// CompactMem (cbNeeded: Size) : Size; // CompactMem (cbNeeded: Size) : Size;
case 0xa04c: case 0xa04c:
d0 = MM::CompactMem(trap); d0 = MM::CompactMem(trap);