The LazyBoy Library Manual - DOS_Release

Part of the Memory Management group.

%imacro DOS_Release 1
Prefers: ES

Release a DOS memory block.

%1 is the segment of memory block to free.

If successful on return, Carry Flag will be clear.

There are only two reason for a request to possibly fail. The first is when the segment provided is not a valid memory block address and is most likely a program bug. The second reason is when the MCB chain has been damaged. If the MCB chain is damaged, the operating system is unstable and will require a reboot. Either error is very bad.

If either error occurs and DEBUG is enabled, the program will Terminate with an error code. If DEBUG is not enabled, the macro will store the error in EXIT_CODE return with the Carry flag set. The program should shut down as soon as possible.

I may change this behaviour to always Terminate the program in the event that either error is encountered.

Example:

    DOS_Release ES      ; free memory block at segment ES

See also: DOS_Alloc, DOS_Resize and EXIT_CODE.