mirror of https://github.com/nmlgc/ReC98.git
[Reduction] #507: filelength
This commit is contained in:
parent
624119866b
commit
8ae2349005
|
@ -0,0 +1,46 @@
|
|||
; long __cdecl __far filelength(int handle)
|
||||
_filelength proc DIST
|
||||
@@Position = dword ptr -4
|
||||
@@handle = word ptr dPtrSize + 2
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 4
|
||||
push si
|
||||
push di
|
||||
mov ax, 4201h
|
||||
mov bx, [bp+@@handle]
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h
|
||||
jb short @@filelengthFailed
|
||||
push dx
|
||||
push ax
|
||||
mov ax, 4202h
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h
|
||||
mov word ptr [bp+@@Position], ax
|
||||
mov word ptr [bp+@@Position+2], dx
|
||||
pop dx
|
||||
pop cx
|
||||
jb short @@filelengthFailed
|
||||
mov ax, 4200h
|
||||
int 21h
|
||||
jb short @@filelengthFailed
|
||||
mov dx, word ptr [bp+@@Position+2]
|
||||
mov ax, word ptr [bp+@@Position]
|
||||
jmp short @@ret
|
||||
|
||||
@@filelengthFailed:
|
||||
push ax
|
||||
call __IOERROR
|
||||
cwd
|
||||
|
||||
@@ret:
|
||||
pop di
|
||||
pop si
|
||||
mov sp, bp
|
||||
pop bp
|
||||
retf
|
||||
_filelength endp
|
|
@ -4928,64 +4928,7 @@ loc_3D09:
|
|||
_fclose endp
|
||||
|
||||
include libs/BorlandC/fflush.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: library function bp-based frame
|
||||
|
||||
; __int32 __cdecl filelength(int handle)
|
||||
_filelength proc far
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
handle = word ptr 6
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 4
|
||||
push si
|
||||
push di
|
||||
mov ax, 4201h
|
||||
mov bx, [bp+handle]
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_3E1D
|
||||
push dx
|
||||
push ax
|
||||
mov ax, 4202h
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov [bp+var_4], ax
|
||||
mov [bp+var_2], dx
|
||||
pop dx
|
||||
pop cx
|
||||
jb short loc_3E1D
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
jb short loc_3E1D
|
||||
mov dx, [bp+var_2]
|
||||
mov ax, [bp+var_4]
|
||||
jmp short loc_3E22
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_3E1D:
|
||||
push ax
|
||||
call __IOERROR
|
||||
cwd
|
||||
|
||||
loc_3E22:
|
||||
pop di
|
||||
pop si
|
||||
mov sp, bp
|
||||
pop bp
|
||||
retf
|
||||
_filelength endp
|
||||
|
||||
include libs/BorlandC/flength.asm
|
||||
include libs/BorlandC/flushall.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
|
59
th01_op.asm
59
th01_op.asm
|
@ -4708,64 +4708,7 @@ loc_3DE1:
|
|||
_fclose endp
|
||||
|
||||
include libs/BorlandC/fflush.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: library function bp-based frame
|
||||
|
||||
; __int32 __cdecl filelength(int handle)
|
||||
_filelength proc far
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
handle = word ptr 6
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 4
|
||||
push si
|
||||
push di
|
||||
mov ax, 4201h
|
||||
mov bx, [bp+handle]
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_3EF5
|
||||
push dx
|
||||
push ax
|
||||
mov ax, 4202h
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov [bp+var_4], ax
|
||||
mov [bp+var_2], dx
|
||||
pop dx
|
||||
pop cx
|
||||
jb short loc_3EF5
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
jb short loc_3EF5
|
||||
mov dx, [bp+var_2]
|
||||
mov ax, [bp+var_4]
|
||||
jmp short loc_3EFA
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_3EF5:
|
||||
push ax
|
||||
call __IOERROR
|
||||
cwd
|
||||
|
||||
loc_3EFA:
|
||||
pop di
|
||||
pop si
|
||||
mov sp, bp
|
||||
pop bp
|
||||
retf
|
||||
_filelength endp
|
||||
|
||||
include libs/BorlandC/flength.asm
|
||||
include libs/BorlandC/flushall.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
|
|
@ -7958,64 +7958,7 @@ loc_5361:
|
|||
_fclose endp
|
||||
|
||||
include libs/BorlandC/fflush.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: library function bp-based frame
|
||||
|
||||
; __int32 __cdecl filelength(int handle)
|
||||
_filelength proc far
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
handle = word ptr 6
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 4
|
||||
push si
|
||||
push di
|
||||
mov ax, 4201h
|
||||
mov bx, [bp+handle]
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_5475
|
||||
push dx
|
||||
push ax
|
||||
mov ax, 4202h
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov [bp+var_4], ax
|
||||
mov [bp+var_2], dx
|
||||
pop dx
|
||||
pop cx
|
||||
jb short loc_5475
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
jb short loc_5475
|
||||
mov dx, [bp+var_2]
|
||||
mov ax, [bp+var_4]
|
||||
jmp short loc_547A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_5475:
|
||||
push ax
|
||||
call __IOERROR
|
||||
cwd
|
||||
|
||||
loc_547A:
|
||||
pop di
|
||||
pop si
|
||||
mov sp, bp
|
||||
pop bp
|
||||
retf
|
||||
_filelength endp
|
||||
|
||||
include libs/BorlandC/flength.asm
|
||||
include libs/BorlandC/flushall.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
|
Loading…
Reference in New Issue