ReC98/libs/BorlandC/flushall.asm

54 lines
859 B
NASM
Raw Normal View History

2014-09-02 19:26:48 +00:00
; int flushall(void)
_flushall proc
2014-09-02 19:26:48 +00:00
@@Cpt = word ptr -(dPtrSize + 4)
@@Nb = word ptr -(dPtrSize + 2)
@@fp = DPTR_ -(dPtrSize)
if LDATA
@@local_stack = 8
2014-09-02 19:26:48 +00:00
else
@@local_stack = 6
2014-09-02 19:26:48 +00:00
endif
push bp
mov bp, sp
sub sp, @@local_stack
push si
push di
mov [bp+@@Cpt], 0
mov ax, __nfile
mov [bp+@@Nb], ax
if LDATA
mov word ptr [bp+@@fp+2], ds
endif
mov word ptr [bp+@@fp], offset _streams
jmp short flushall_loop
2014-09-02 19:26:48 +00:00
flushall_RDWR?:
2014-09-02 19:26:48 +00:00
LES_ bx, [bp+@@fp]
test byte ptr ES_[bx+FILE.flags], 3
jz short flushall_next
2014-09-02 19:26:48 +00:00
if LDATA
push word ptr [bp+@@fp+2]
endif
push bx
nopcall _fflush
popCX_
2014-09-02 19:26:48 +00:00
pop cx
inc [bp+@@Cpt]
flushall_next:
2014-09-02 19:26:48 +00:00
add word ptr [bp+@@fp], size FILE
flushall_loop:
2014-09-02 19:26:48 +00:00
mov ax, [bp+@@Nb]
dec [bp+@@Nb]
or ax, ax
jnz short flushall_RDWR?
2014-09-02 19:26:48 +00:00
mov ax, [bp+@@Cpt]
pop di
pop si
mov sp, bp
pop bp
ret
_flushall endp