;************************************************************** ;*** XMSINIT.ASM *** ;*** *** ;*** function XMS_Xms.init *** ;*** : Boolean; *** ;*** *** ;*** Initializes the XMS interface. Returns a zero *** ;*** if interface successfully initialized. *** ;*** *** ;************************************************************** ;-------------------------------------- ; ; Declare memory model and language ; .model large,pascal ;-------------------------------------- ; ; Include xms definition file ; include xmsdefs.asm ;-------------------------------------- ; ; Declare error WORD as extrn to this ; module ; extrn errno:WORD extrn xmsHandler ;-------------------------------------- ; ; Declare function as PUBLIC ; public XMS_Xms@init public xms_defaultHandler ;-------------------------------------- ; ; Begin code segment ; .code XMS_Xms@init proc self: Far Ptr Word mov ah,XFuncXMS ; XMS functions mov al,XFuncXMSPres ; Determine is XMS present int XFunc ; Call extended functions cmp al,XMSPresent ; See if it's there jne noXMS ; Nope, return an error ; ; It's there, so let's get the handler address: ; mov ah,XFuncXMS ; XMS functions mov al,XFuncXMSEntry; Get handler entry point int XFunc ; Call extended functions mov word ptr xmsHandler,bx ; Handler offset mov word ptr xmsHandler+2,es ; Handler segment mov ax,XMSErrOK ; no error xor dx,dx ret noXMS: mov ax,XMSErrUnimp ; No XMS (Unimplemented function) mov errno,ax ; Copy to errno xor dx,dx ret XMS_xms@init endp ; end of procedure ; ; The xms_default_handler is used so that a call to ; xmsHandler before XMS is initialized will return an ; error. This is replaced by the actual handler when ; xms_init is called. ; xms_defaultHandler proc xor ax,ax ; ax to zero means error mov bl,XMSErrUnimp ; Unimplemented function ret xms_defaultHandler endp end ; end of source file