diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index f72d089..58ec8aa 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -294,6 +294,29 @@ namespace MM return mplite_maxmem(&pool); } + uint32_t MaxBlock(uint16_t trap) + { + /* + * The MaxBlock function returns the maximum contiguous space, in bytes, that you + * could obtain after compacting the current heap zone. MaxBlock does not actually + * do the compaction. + */ + + /* + * on entry: + * (nothing) + * + * on exit: + * D0: function result (long word) + * + */ + + Log("%04x MaxBlock()\n", trap); + + SetMemError(0); + return mplite_maxmem(&pool); + } + uint32_t FreeMem(uint16_t trap) { // total free memory. @@ -312,6 +335,9 @@ namespace MM return mplite_freemem(&pool); } + + + uint16_t ReserveMem(uint16_t trap) { /* diff --git a/toolbox/mm.h b/toolbox/mm.h index 478c354..2cf7457 100644 --- a/toolbox/mm.h +++ b/toolbox/mm.h @@ -27,6 +27,7 @@ namespace MM uint16_t BlockMove(uint16_t trap); uint32_t CompactMem(uint16_t trap); uint32_t MaxMem(uint16_t trap); + uint32_t MaxBlock(uint16_t trap); uint32_t FreeMem(uint16_t trap); uint16_t ReserveMem(uint16_t trap); diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index 904fbb0..b689ff6 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -159,6 +159,10 @@ namespace ToolBox { d0 = MM::StripAddress(trap); break; + case 0xa061: + d0 = MM::MaxBlock(trap); + break; + // MoveHHi (h: Handle); case 0xa064: d0 = MM::MoveHHi(trap);