ReC98/libs/BorlandC/xfclose.asm

41 lines
624 B
NASM

__xfclose proc
@@i = word ptr -(dPtrSize + 2)
@@fp = DPTR_ -(dPtrSize)
push bp
mov bp, sp
sub sp, dPtrSize + 2
push si
push di
mov [bp+@@i], 0
if LDATA
mov word ptr [bp+@@fp+2], ds
endif
mov word ptr [bp+@@fp], offset _streams
jmp short @@check
@@loop:
LES_ bx, [bp+@@fp]
test byte ptr ES_[bx+FILE.flags], 3
jz short xfclose_next
push word ptr [bp+@@fp+2]
push bx
nopcall _fclose
popCX_
pop cx
xfclose_next:
add word ptr [bp+@@fp], size FILE
inc [bp+@@i]
@@check:
mov ax, [bp+@@i]
cmp ax, __nfile
jb short @@loop
pop di
pop si
mov sp, bp
pop bp
ret
__xfclose endp