HGetState

This commit is contained in:
Kelvin Sherlock 2013-08-03 19:17:50 -04:00
parent bdce056449
commit 2bd086232b
3 changed files with 50 additions and 1 deletions

View File

@ -973,7 +973,50 @@ namespace MM
#pragma mark Handle attributes
// these are all nops for now.
uint16_t HGetState(uint16_t trap)
{
/*
* on entry:
* A0 Handle
*
* on exit:
* D0 flag byte
*
*/
unsigned flags = 0;
uint32_t hh = cpuGetAReg(0);
Log("%04x HGetState(%08x)\n", trap, hh);
auto iter = HandleMap.find(hh);
if (iter == HandleMap.end()) return SetMemError(MacOS::memWZErr);
/*
* flag bits:
* 0-4: reserved
* 5: is a resource
* 6: set if purgeable
* 7: set if locked
*/
const auto &info = iter->second;
// resouce not yet supported...
// would need extra field and support in RM:: when
// creating.
// see HSetRBit, HClrRBit
if (info.resource) flags |= (1 << 5);
if (info.purgeable) flags |= (1 << 6);
if (info.locked) flags |= (1 << 7);
SetMemError(0);
return flags;
}
uint16_t HPurge(uint16_t trap)
{

View File

@ -52,6 +52,8 @@ namespace MM
uint16_t SetHandleSize(uint16_t);
uint16_t SetPtrSize(uint16_t);
uint16_t HGetState(uint16_t trap);
uint16_t HLock(uint16_t trap);
uint16_t HUnlock(uint16_t trap);

View File

@ -221,6 +221,10 @@ namespace ToolBox {
d0 = MM::MaxBlock(trap);
break;
case 0xa069:
d0 = MM::HGetState(trap);
break;
// MoveHHi (h: Handle);
case 0xa064:
d0 = MM::MoveHHi(trap);