The LazyBoy Library Manual - Terminate

Part of the Library core group.

%imacro Terminate 0-1
Prefers: nothing

Safely shutdown the program and exit to DOS.

If a value is provided to the macro, it is stored in the EXIT_CODE before the shut down process has begun.

If the EXIT_CODE is not zero, the program will terminate with an error message and return lower byte of the EXIT_CODE as an error valueß to DOS.

When the approrate macro groups are not excluded, the video mode and cursor will be restored. The mouse will be shutdown. XMS memory will be freed. And, any other functionality initialized by the library at program startup will be released as needed to perform a safe shutdown. This does not include actions performed by the program such as files left open, memory allocations, etc.

Note: When DEBUG is enabled, the stack will be checked for memory leaks. This is only of limited use and does not mean there is a Stack Bug. It simply means there is still data on the stack when the Terminate macro was invoked.

See also EXIT_CODE and EXIT_CHAIN.