;**************************************************************
;***    EMS520.ASM                                          ***
;***                                                        ***
;***    function        EMS_EmBlk.getHandleAttr40(          ***
;***                        var attribute:  Word)           ***
;***                        : Boolean;                      ***
;***                        external;                       ***
;***                                                        ***
;***    Get volatile (0) or non-volatile (1) attribute      ***
;***    associated with the handle.                         ***
;***                                                        ***
;***    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_EmBlk@getHandleAttr40

        .code

EMS_EmBlk@getHandleAttr40   proc attr:Far Ptr Word, handle:Far Ptr Word

        les     bx,handle
        mov     dx,es:[bx]              ; DX gets EMS handle

        mov     ax,GetHandleAttr40      ; Do call
        int     Ems           

        or      ah,ah                   ; Set flags
        jnz     error

        xor     ah,ah                   ; Zero extend attr to 16 bits
        les     bx,attr                 ; Return attribute
        mov     es:[bx],ax

        xor     ax,ax                   ; return OK
        ret         

error:
        mov     al,ah                   ; AL get error code
        xor     ah,ah                   ; Zero extend
        mov     errno,ax                ; Save in errno too
        ret

EMS_EmBlk@getHandleAttr40   endp        ; End of procedure

        end                             ; End of source file
