;************************************************************** ;*** EMS43.ASM *** ;*** *** ;*** function EMS_EmBlk.allocEM( *** ;*** pages: Word) *** ;*** : Boolean; *** ;*** *** ;*** Takes the number of pages to allocate and returns *** ;*** a handle with that number of pages. On error, *** ;*** returns a non-zero error code. *** ;*** *** ;*** *** ;*** (Ems Version 3.0) *** ;************************************************************** .model large,pascal include emsdefs.asm extrn errno:WORD ; ; Define entry point ; public EMS_EmBLk@allocEM .code EMS_EmBlk@allocEM proc pages:Word, handle:Far Ptr Word ; ; BX takes the number of pages to allocate: ; mov bx,pages mov ah,AllocateEM ; Move function code int Ems ; Do the ems call or ah,ah ; Set flags jnz error ; ; DX now has the EMM handle. Return it: ; les bx,handle ; Get address of handle mov es:[bx],dx ; Put handle down xor ax,ax ; AX gets 0 ret ; Return to caller error: mov al,ah ; Transfer return code to al xor ah,ah ; Zero high byte mov errno,ax ; Save in errno too ret ; Return to caller EMS_EmBlk@allocEM endp ; End of procedure end ; End of source code