mirror of
https://github.com/ksherlock/mpw.git
synced 2025-02-02 14:30:40 +00:00
MM::ReserveMem and minor cleanups
This commit is contained in:
parent
05baff21ad
commit
cbbab65d2c
@ -271,6 +271,7 @@ namespace MM
|
|||||||
Log("%04x CompactMem(%08x)\n", trap, cbNeeded);
|
Log("%04x CompactMem(%08x)\n", trap, cbNeeded);
|
||||||
|
|
||||||
|
|
||||||
|
SetMemError(0);
|
||||||
return mplite_maxmem(&pool);
|
return mplite_maxmem(&pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,6 +289,7 @@ namespace MM
|
|||||||
|
|
||||||
Log("%04x MaxMem()\n", trap);
|
Log("%04x MaxMem()\n", trap);
|
||||||
|
|
||||||
|
SetMemError(0);
|
||||||
return mplite_maxmem(&pool);
|
return mplite_maxmem(&pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,9 +307,33 @@ namespace MM
|
|||||||
|
|
||||||
Log("%04x FreeMem()\n", trap);
|
Log("%04x FreeMem()\n", trap);
|
||||||
|
|
||||||
|
SetMemError(0);
|
||||||
return mplite_freemem(&pool);
|
return mplite_freemem(&pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t ReserveMem(uint16_t trap)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* on entry:
|
||||||
|
* D0: cbNeeded (long word)
|
||||||
|
*
|
||||||
|
* on exit:
|
||||||
|
* D0: Result code.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint32_t cbNeeded = cpuGetDReg(0);
|
||||||
|
uint32_t available;
|
||||||
|
|
||||||
|
Log("%04x ReserveMem($%08x)\n", trap, cbNeeded);
|
||||||
|
|
||||||
|
available = mplite_maxmem(&pool);
|
||||||
|
// TODO -- if available < cbNeeded, purge handle and retry?
|
||||||
|
if (available < cbNeeded) return SetMemError(memFullErr);
|
||||||
|
|
||||||
|
return SetMemError(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t MoveHHi(uint16_t trap)
|
uint16_t MoveHHi(uint16_t trap)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,9 @@ namespace MM
|
|||||||
uint32_t CompactMem(uint16_t trap);
|
uint32_t CompactMem(uint16_t trap);
|
||||||
uint32_t MaxMem(uint16_t trap);
|
uint32_t MaxMem(uint16_t trap);
|
||||||
uint32_t FreeMem(uint16_t trap);
|
uint32_t FreeMem(uint16_t trap);
|
||||||
|
uint16_t ReserveMem(uint16_t trap);
|
||||||
|
|
||||||
|
|
||||||
uint16_t DisposeHandle(uint16_t trap);
|
uint16_t DisposeHandle(uint16_t trap);
|
||||||
uint16_t DisposePtr(uint16_t trap);
|
uint16_t DisposePtr(uint16_t trap);
|
||||||
|
|
||||||
|
@ -141,6 +141,10 @@ namespace ToolBox {
|
|||||||
d0 = MM::CompactMem(trap);
|
d0 = MM::CompactMem(trap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0xa040:
|
||||||
|
d0 = MM::ReserveMem(trap);
|
||||||
|
break;
|
||||||
|
|
||||||
case 0xa055:
|
case 0xa055:
|
||||||
d0 = MM::StripAddress(trap);
|
d0 = MM::StripAddress(trap);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user