Application Examples
+ ’the EMM pages in use.’,
Error_Code);
Writeln (APPLICATION_PAGE_COUNT,
’ page(s) deallocated.’);
Writeln;
Writeln (’EMM test program completed.’);
end.
Example 3
The following program is written in Microsoft’s macro assembler.
CODE
SEGMENT
ASSUME CS:CODE, DS:CODE
MOV
AX, CS
MOV
DS, AX
check_emm_installed:
MOV
AH,35h
; AH = DOS get interrupt vector function
MOV
AL,67h
; AL = EMM interrupt vector number
INT
21h
MOV
DI,0Ah
; ES:DI points to where device name
; should be
LEA
SI,EMM_device_name
; DS:SI points to ASCIIZ string
; containing EMM device name
MOV
CX,device_name_length ; set up loop counter for string op
CLD
; set up direction flag for forward
REPE
CMPSB
; Compare the strings
JNE
exit
; IF strings are not equal THEN exit
; ELSE
check_enough_unallocated_pages:
MOV
AH,41h
;
AH = EMM get unallocated page
;
count function code
INT
67h
OR
AH,AH
; Check EMM status
JNZ
emm_error_handler
; IF emm_error THEN goto error handler
; ELSE
allocate_expanded_memory_pages:
MOV
AH,43h
;
AH = EMM allocate pages
;
function code
MOV
BX,2
;
BX = number of pages needed
INT
67h
OR
AH,AH
; Check EMM status
JNZ
emm_error_handler
; IF emm_error THEN goto error handler
; ELSE
MOV
emm_handle,DX
;
save EMM handle
map_expanded_memory_pages:
MOV
AH,44h
; AH = EMM map pages function
MOV
DX,emm_handle
; DX = application’s handle
4-21
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com