;************************************************************** ;*** XMS10.ASM *** ;*** *** ;*** function XMS_Xms.allocUM( *** ;*** size: Word; *** ;*** var address: Pointer; *** ;*** var actualSize: Word) *** ;*** : Boolean; *** ;*** *** ;*** Allocates a block of upper memory blockSize *** ;*** paragraphs long. On successful return, address has *** ;*** the address of the block. If there is not enough *** ;*** memory, actual size gives largest chunk available. *** ;*** *** ;************************************************************** .model large,pascal include xmsdefs.asm extrn errno:WORD extrn xmsHandler:DWord ; ; Define entry point ; public XMS_Xms@allocUM .code XMS_Xms@allocUM proc blockSize:Word, address:Far Ptr DWord, actual:Far Ptr Word, self:DWord mov dx,blockSize ; size in KB of block mov ah,XMSAllocUM ; Function code call xmsHandler ; call the guy or ax,ax ; AX=0 means error jz errorReturn mov ax,bx ; Save returned segment # les bx,address xor cx,cx ; Get a zero for the offset mov es:[bx],cx ; offset mov es:[bx+2],ax ; segment les bx,actual ; Return the actual size mov es:[bx],dx mov ax,XMSErrOK ; No error ret errorReturn: mov al,bl ; Move error code to AL xor ah,ah ; Zero extend to 16 bits mov errno,ax ; Copy to errno cmp ax,XMSErrSmUMB ; See if there's a smaller UMB je errCommon ; There is DX has it's size xor dx,dx ; Indicate size is zero errCommon: les bx,actual ; Return the largest block size mov es:[bx],dx ret XMS_Xms@allocUM endp ; end of procedure end