mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-25 04:31:52 +00:00
DisposePtr
This commit is contained in:
parent
ce832bca76
commit
c5626a0fc4
@ -114,6 +114,35 @@ namespace MM
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t DisposePtr(uint16_t trap)
|
||||
{
|
||||
/*
|
||||
* on entry:
|
||||
* A0 Pointer to the nonrelocatable block to be disposed of
|
||||
*
|
||||
* on exit:
|
||||
* D0 Result code
|
||||
*
|
||||
*/
|
||||
|
||||
uint32_t mcptr = cpuGetAReg(0);
|
||||
|
||||
fprintf(stderr, "%04x DisposePtr(%08x)\n", trap, mcptr);
|
||||
|
||||
|
||||
auto iter = PtrMap.find(mcptr);
|
||||
|
||||
if (iter == PtrMap.end()) return memWZErr;
|
||||
PtrMap.erase(iter);
|
||||
|
||||
uint8_t *ptr = mcptr + Memory;
|
||||
|
||||
mplite_free(&pool, ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint16_t NewPtr(uint16_t trap)
|
||||
{
|
||||
|
@ -7,12 +7,14 @@ namespace MM
|
||||
{
|
||||
enum
|
||||
{
|
||||
memFullErr = -108
|
||||
memFullErr = -108,
|
||||
memWZErr = -111,
|
||||
};
|
||||
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t reserved);
|
||||
|
||||
uint16_t BlockMove(uint16_t trap);
|
||||
uint16_t DisposePtr(uint16_t trap);
|
||||
uint16_t NewPtr(uint16_t trap);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user