mirror of https://github.com/nmlgc/ReC98.git
[Reduction] #245: dos_filesize
This commit is contained in:
parent
9e5b986403
commit
a779b84843
|
@ -0,0 +1,78 @@
|
|||
; master library - DOS - file - size
|
||||
;
|
||||
; Description:
|
||||
; ファイルの大きさを得る
|
||||
;
|
||||
; Function/Procedures:
|
||||
; long dos_filesize( int fh ) ;
|
||||
;
|
||||
; Parameters:
|
||||
; fh ファイルハンドル
|
||||
;
|
||||
; Returns:
|
||||
; InvalidHandle (cy=1) ハンドルが無効
|
||||
; 0〜 (cy=0) ファイルの大きさ
|
||||
;
|
||||
; Binding Target:
|
||||
; Microsoft-C / Turbo-C / Turbo Pascal
|
||||
;
|
||||
; Running Target:
|
||||
; MS-DOS
|
||||
;
|
||||
; Requiring Resources:
|
||||
; CPU: 8086
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;
|
||||
; Assembly Language Note:
|
||||
;
|
||||
;
|
||||
; Compiler/Assembler:
|
||||
; TASM 3.0
|
||||
; OPTASM 1.6
|
||||
;
|
||||
; Author:
|
||||
; 恋塚昭彦
|
||||
;
|
||||
; Revision History:
|
||||
; 94/ 2/14 Initial: dosfsize.asm/master.lib 0.22a
|
||||
; 95/ 1/21 [M0.23] BUGFIX
|
||||
|
||||
func DOS_FILESIZE ; dos_filesize() {
|
||||
mov BX,SP
|
||||
@@filehandle = (RETSIZE+0)*2
|
||||
mov BX,SS:[BX+@@filehandle]
|
||||
|
||||
mov AX,4201h ; 現在位置を得る
|
||||
xor CX,CX
|
||||
mov DX,CX
|
||||
int 21h
|
||||
jc short @@FAULT
|
||||
|
||||
push SI
|
||||
push DI
|
||||
|
||||
push AX ; 現在位置をpush
|
||||
push DX
|
||||
xor DX,DX
|
||||
mov AX,4202h ; 末尾へ (CX,DXは既に 0)
|
||||
int 21h
|
||||
mov SI,AX ; 末尾位置を DI,SIに保存
|
||||
mov DI,DX
|
||||
|
||||
pop CX
|
||||
pop DX
|
||||
mov AX,4200h ; 元の位置へ戻る
|
||||
int 21h
|
||||
|
||||
mov AX,SI
|
||||
mov DX,DI
|
||||
pop DI
|
||||
pop SI
|
||||
ret 2
|
||||
@@FAULT:
|
||||
neg AX ; InvalidHandle
|
||||
sbb DX,DX ; 必ず-1, cy=1
|
||||
ret 2
|
||||
endfunc ; }
|
|
@ -42,35 +42,7 @@ include libs/master.lib/bseek.asm
|
|||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/cutline.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
loc_6F6:
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_726
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0CDh
|
||||
byte_711 db 21h
|
||||
byte_712 db 8Bh
|
||||
db 0F0h, 8Bh, 0FAh, 59h, 5Ah, 0B8h, 0, 42h, 0CDh, 21h
|
||||
db 8Bh, 0C6h, 8Bh, 0D7h, 5Fh, 5Eh, 0CAh, 2, 0
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_726:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_setvect.asm
|
||||
include libs/master.lib/egc.asm
|
||||
|
||||
|
@ -400,8 +372,7 @@ sub_98C endp
|
|||
|
||||
sub_9CE proc far
|
||||
push word_1DF80
|
||||
push cs
|
||||
call loc_6F6
|
||||
call dos_filesize
|
||||
jb short loc_9D9
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -43,47 +43,7 @@ include libs/master.lib/bseek.asm
|
|||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/cutline.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_73A proc far
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_76A
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov si, ax
|
||||
mov di, dx
|
||||
pop cx
|
||||
pop dx
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
mov ax, si
|
||||
mov dx, di
|
||||
pop di
|
||||
pop si
|
||||
retf 2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_76A:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
sub_73A endp
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_setvect.asm
|
||||
include libs/master.lib/egc.asm
|
||||
include libs/master.lib/egc_shift_down.asm
|
||||
|
@ -416,8 +376,7 @@ sub_BD8 endp
|
|||
|
||||
sub_C1A proc far
|
||||
push word_D396
|
||||
push cs
|
||||
call near ptr sub_73A
|
||||
call dos_filesize
|
||||
jb short loc_C25
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -42,47 +42,7 @@ include libs/master.lib/bread.asm
|
|||
include libs/master.lib/bseek.asm
|
||||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_6C6 proc far
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_6F6
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov si, ax
|
||||
mov di, dx
|
||||
pop cx
|
||||
pop dx
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
mov ax, si
|
||||
mov dx, di
|
||||
pop di
|
||||
pop si
|
||||
retf 2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6F6:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
sub_6C6 endp
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_keyclear.asm
|
||||
include libs/master.lib/dos_setvect.asm
|
||||
include libs/master.lib/egc.asm
|
||||
|
@ -452,8 +412,7 @@ sub_9A2 endp
|
|||
|
||||
sub_9E4 proc far
|
||||
push word_E946
|
||||
push cs
|
||||
call near ptr sub_6C6
|
||||
call dos_filesize
|
||||
jb short loc_9EF
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -44,47 +44,7 @@ include libs/master.lib/bseek.asm
|
|||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/cutline.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_826 proc far
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_856
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov si, ax
|
||||
mov di, dx
|
||||
pop cx
|
||||
pop dx
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
mov ax, si
|
||||
mov dx, di
|
||||
pop di
|
||||
pop si
|
||||
retf 2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_856:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
sub_826 endp
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_keyclear.asm
|
||||
include libs/master.lib/dos_read.asm
|
||||
include libs/master.lib/dos_seek.asm
|
||||
|
@ -463,8 +423,7 @@ sub_F50 endp
|
|||
|
||||
sub_F92 proc far
|
||||
push word_216A0
|
||||
push cs
|
||||
call near ptr sub_826
|
||||
call dos_filesize
|
||||
jb short loc_F9D
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -43,47 +43,7 @@ include libs/master.lib/bread.asm
|
|||
include libs/master.lib/bseek.asm
|
||||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_7B2 proc far
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_7E2
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov si, ax
|
||||
mov di, dx
|
||||
pop cx
|
||||
pop dx
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
mov ax, si
|
||||
mov dx, di
|
||||
pop di
|
||||
pop si
|
||||
retf 2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_7E2:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
sub_7B2 endp
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_keyclear.asm
|
||||
include libs/master.lib/dos_read.asm
|
||||
include libs/master.lib/dos_seek.asm
|
||||
|
@ -456,8 +416,7 @@ sub_AC4 endp
|
|||
|
||||
sub_B06 proc far
|
||||
push word_E61E
|
||||
push cs
|
||||
call near ptr sub_7B2
|
||||
call dos_filesize
|
||||
jb short loc_B11
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -42,47 +42,7 @@ include libs/master.lib/bread.asm
|
|||
include libs/master.lib/bseek.asm
|
||||
include libs/master.lib/bseek_.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_790 proc far
|
||||
mov bx, sp
|
||||
mov bx, ss:[bx+4]
|
||||
mov ax, 4201h
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from present location
|
||||
jb short loc_7C0
|
||||
push si
|
||||
push di
|
||||
push ax
|
||||
push dx
|
||||
xor dx, dx
|
||||
mov ax, 4202h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from end of file
|
||||
mov si, ax
|
||||
mov di, dx
|
||||
pop cx
|
||||
pop dx
|
||||
mov ax, 4200h
|
||||
int 21h ; DOS - 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
|
||||
; AL = method: offset from beginning of file
|
||||
mov ax, si
|
||||
mov dx, di
|
||||
pop di
|
||||
pop si
|
||||
retf 2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_7C0:
|
||||
neg ax
|
||||
sbb dx, dx
|
||||
retf 2
|
||||
sub_790 endp
|
||||
|
||||
include libs/master.lib/dos_filesize.asm
|
||||
include libs/master.lib/dos_keyclear.asm
|
||||
include libs/master.lib/dos_read.asm
|
||||
include libs/master.lib/dos_seek.asm
|
||||
|
@ -454,8 +414,7 @@ sub_AA2 endp
|
|||
|
||||
sub_AE4 proc far
|
||||
push word_102FE
|
||||
push cs
|
||||
call near ptr sub_790
|
||||
call dos_filesize
|
||||
jb short loc_AEF
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue