Z88 Developers' Notes
Contents   Contents of System Calls

OS_Mfr, free (previously allocated block) memory

RST 20H, DEFB $57

IN:

     IX = memory pool handle (returned from OS_Mop)
     BC = size of memory to release
     AHL = extended pointer address to beginning of memory block (A = bank)
OUT, if call successful:
     Fc = 0
OUT, if call failed:
     Fc = 1
     A = error code:
          RC_HAND ($08), bad handle
          RC_BAD ($04), invalid AHL/BC/IX combination
Registers changed after return:
     ..BCDEHL/IXIY same
     AF....../.... different
Notes:
RC_BAD may occur if the IX is the handle for another pool, or if A does not match pool bank number, or HL is not allocated in that pool.
Bugs:
Z88 crashes with a blinking "FAIL" message if you try to free memory that was already released with a previous OS_Mfr.
 
Related calls:
OS_Bix, Bind in extended address
OS_Box, restore bindings after OS_Bix
OS_Fc, select fast code (fast bank switching)
OS_Mal, allocate memory
OS_Mcl, close memory (free memory pool)
OS_Mgb, get current bank binding in segment
OS_Mop, open memory (allocate memory pool)
OS_Mpb, set new bank binding in segment