diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index dc99775..4998880 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -124,6 +124,27 @@ namespace MM return 0; } + + uint32_t CompactMem(uint16_t trap) + { + // todo -- add function to check pool for largest block? + + /* + * on entry: + * D0: cbNeeded (long word) + * + * on exit: + * D0: function result (long word) + * + */ + uint32_t cbNeeded = cpuGetDReg(0); + + fprintf(stderr, "%04x CompactMem(%08x)\n", trap, cbNeeded); + + return 0x0f0000; + } + + uint16_t DisposePtr(uint16_t trap) { /* diff --git a/toolbox/mm.h b/toolbox/mm.h index 77d3cfc..88870ff 100644 --- a/toolbox/mm.h +++ b/toolbox/mm.h @@ -14,6 +14,7 @@ namespace MM bool Init(uint8_t *memory, uint32_t memorySize, uint32_t reserved); uint16_t BlockMove(uint16_t trap); + uint32_t CompactMem(uint16_t trap); uint16_t DisposePtr(uint16_t trap); uint16_t DisposeHandle(uint16_t trap); @@ -21,4 +22,6 @@ namespace MM uint16_t NewHandle(uint16_t trap); } + + #endif \ No newline at end of file diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index c0bf330..f31b900 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -58,6 +58,11 @@ namespace ToolBox { d0 = MM::BlockMove(trap); break; + // CompactMem (cbNeeded: Size) : Size; + case 0xa04c: + d0 = MM::CompactMem(trap); + break; + // ReadDateTime (VAR sees: LONGINT) : OSErr; case 0xa039: