mov bx, LinkFlag ;1= link, 0 = unlink
mov ax, 5803h ;Set Upper-Memory Link
int 21h
jc error_handler ;carry clear means error
Set Upper-Memory Link (Function 5803h) links or unlinks the upper memory area. When this area is linked, a program can allocate memory from it.
LinkFlag
Specifies whether to link or unlink the upper memory area. If this parameter is 01h, the function links the area; if the parameter is 00h, the function unlinks the area.
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION. |
0007h | ERROR_ARENA_TRASHED |
The function returns 0001h (ERROR_INVALID_FUNCTION) if MS-DOS has been loaded without the command dos=umb having been specified in the CONFIG.SYS file.
For more information about upper memory blocks and memory allocation, see Chapter 5, “Program Management.”
Function 48h Allocate Memory
Function 5802H Get Upper-Memory Link