;**************************************************************
;***    EMS44.ASM                                           ***
;***                                                        ***
;***    function        EMS_EmBlk.mapPage(                  ***
;***                        physical_page:  Word;           ***
;***                        logical_page:   Word)           ***
;***                        : Boolean;                      ***
;***                                                        ***
;***    Maps a physical page into a specified logical page. ***
;***                                                        ***
;***                                                        ***
;***    (Ems Version 3.0)                                   ***
;**************************************************************

        .model  large,pascal   

        include emsdefs.asm 

        extrn   errno:WORD  

;
;   Define entry point
;
        public  EMS_EmBlk@mapPage

        .code

EMS_EmBlk@mapPage   proc    physical_page:Word, logical_page:Word, handle:Far Ptr Word

;
;   AL takes the physical page number, BX, the logical page number,
;   and DX, the handle.
;
        les     bx,handle
        mov     dx,es:[bx]              ; Get the handle
        mov     ax,physical_page
        mov     bx,logical_page

        mov     ah,MapEMPage            ; Move function code
        int     Ems                     ; Do the ems call

        or      ah,ah                   ; Set flags
        jnz     error

        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@mapPage   endp                ; End of procedure

        end                             ; End of source file




