;**************************************************************
;***    EMS5D2.ASM                                          ***
;***                                                        ***
;***    function        EMS_Ems.releaseAccessKey40(         ***
;***                        a1:             Word;           ***
;***                        a2:             Word)           ***
;***                        : Boolean;                      ***
;***                                                        ***
;***    Release EMM operating system functions              ***
;***                                                        ***
;***    Returns 0 if no error or an error code.             ***
;***                                                        ***
;***                                                        ***
;***                                                        ***
;***    (Ems Version 4.0)                                   ***
;**************************************************************

        .model  large,pascal   

        include emsdefs.asm 

        extrn   errno:WORD  

;
;   Define entry point
;
        public  EMS_Ems@releaseAccessKey40

        .code

EMS_Ems@releaseAccessKey40 proc keyLO:Word, keyHI:Word, self:DWord

        mov     bx,keyHI                ; BX gets access key HI
        mov     cx,keyLO                ; CX gets access key LO

        mov     ax,ReleaseAccessKey40   ; Do the EMS call
        int     Ems           

        or      ah,ah                   ; Set flags
        jnz     error

        xor     ax,ax                   ; Return OK
        ret         

error:
        mov     al,ah                   ; AL gets error code
        xor     ah,ah                   ; Zero extend
        mov     errno,ax                ; Save in errno too
        ret

EMS_Ems@releaseAccessKey40 endp         ; End of procedure

        end                             ; End of source file
