;**************************************************************
;***    EMS550.ASM                                          ***
;***                                                        ***
;***    function        EMS_EmBlk.mapPagesJumpNum40(        ***
;***                        var buffer:     DWord)          ***
;***                        : Boolean;                      ***
;***                                                        ***
;***    Transfers control to EMS location mapped by phys.   ***
;***    page by JUMP                                        ***
;***                                                        ***
;***    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@mapPagesJumpNum40

        .code

EMS_EmBlk@mapPagesJumpNum40 proc buffer:Far Ptr DWord, handle:Far Ptr DWord

        push    ds                      ; Save regs
        push    si

        les     bx,handle
        mov     dx,es:[bx]              ; DX gets the EMS handle
        lds     si,buffer               ; DS:SI gets the buffer address

        mov     ax,MapPagesJumpNum40    ; Make EMS call
        int     Ems           

        or      ah,ah                   ; Set flags
        jnz     error

        xor     ax,ax                   ; Return OK
        pop     si
        pop     ds
        ret         

error:
        pop     si                      ; Restore regs
        pop     ds

        mov     al,ah                   ; AL gets error code
        xor     ah,ah                   ; Zero extend
        mov     errno,ax                ; Save in errno too
        ret

EMS_EmBlk@mapPagesJumpNum40 endp        ; End of procedure

        end                             ; End of source file

