From 84fdeb116f8b180257e6d53244911c0b639f376a Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 18 Dec 2014 14:40:03 -0500 Subject: [PATCH] TempFreeMem --- toolbox/mm.cpp | 14 ++++++++++++-- toolbox/mm.h | 1 + toolbox/toolbox.cpp | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index ba86594..1c56b37 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -1504,9 +1504,19 @@ namespace MM if (address) memoryWriteLong(0, address); ToolReturn<4>(sp, mplite_maxmem(&pool)); - SetMemError(0); // not sure if this is correct. oh well. - return 0; + return SetMemError(0); } + uint16_t TempFreeMem(void) + { + + // FUNCTION TempFreeMem: LongInt; + + Log(" TempFreeMem()\n"); + + ToolReturn<4>(-1, mplite_freemem(&pool)); + + return SetMemError(0); + } } diff --git a/toolbox/mm.h b/toolbox/mm.h index e15a728..4984b65 100644 --- a/toolbox/mm.h +++ b/toolbox/mm.h @@ -88,6 +88,7 @@ namespace MM // OS Dispatch uint16_t TempMaxMem(void); + uint16_t TempFreeMem(void); } diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index 51bc531..44bbde0 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -65,6 +65,9 @@ namespace ToolBox { case 0x0015: return MM::TempMaxMem(); + case 0x0018: + return MM::TempFreeMem(); + default: fprintf(stderr, "OSDispatch: selector %04x not implemented\n", selector);