ReC98/libs/BorlandC/xfclose.asm

43 lines
627 B
NASM
Raw Normal View History

__xfclose proc
2014-09-27 20:51:10 +00:00
@@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 @@next
push word ptr [bp+@@fp+2]
push bx
nopcall _fclose
if LDATA
pop cx
endif
pop cx
@@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