353 ; HEAPLOAD.ASM (FILE.LIB) ; Allm„n rutin f”r att ladda in en fil i heap. ; ; Inparameter: DX = offset filnamn ; Returv„rde: AX = 0 vid fel, annars filens segment (offset alltid 0) ; w EQU word ptr INCLUDE DOS.INC INCLUDE BIOS.INC .DOSSEG .MODEL SMALL .386 .DATA? handle dw ? fsize dd ? fseg dw ? .CODE PUBLIC heap_load heap_load PROC @OpenFile dx,0 jc abort mov handle,ax @GetFileSize handle mov w[fsize[2]],dx mov w[fsize[0]],ax mov eax,fsize add eax,15 shr eax,4 @GetBlock ax jc abort mov fseg,ax mov si,fseg l1: push ds @Read 0,8000h,handle,si pop ds cmp ax,8000h jnz l2 add si,800h jmp l1 l2: @CloseFile handle mov ax,fseg ;Returnera filens segment i AX jmp no_err abort: mov ax,0 no_err: ret heap_load ENDP END . 0