;**************************************************************
;***    EMS46.ASM                                           ***
;***                                                        ***
;***    function        EMS_Ems.getVersion(                 ***
;***                        var version:    Word)           ***
;***                        : Boolean;                      ***
;***                                                        ***
;***    Gives the EMS version.                              ***
;***                                                        ***
;***                                                        ***
;***    (Ems Version 3.0)                                   ***
;**************************************************************

        .model  large,pascal   

        include emsdefs.asm 

        extrn   errno:WORD  

;
;   Define entry point
;
        public  EMS_Ems@getVersion

        .code

EMS_Ems@getVersion proc    version:Far Ptr Word, self:DWord

        mov     ah,GetVersion           ; Move function code
        int     Ems                     ; Do the ems call

        or      ah,ah                   ; Set flags
        jnz     error

;
;   AL now has the EMS version.
;
        xor     ah,ah                   ; Zero extend
        les     bx,version              ; Get address of version
        mov     es:[bx],ax              ; Return it

        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_Ems@getVersion endp                 ; End of procedure

        end                             ; End of source file

