[Reduction] #142: dos_read

This commit is contained in:
nmlgc 2014-08-23 01:07:04 +02:00
parent 4bcebcd875
commit a756bab3cc
7 changed files with 71 additions and 202 deletions

View File

@ -0,0 +1,59 @@
; master library module
;
; Description:
; ファイルの読み込み
;
; Functions/Procedures:
; int dos_read( int fh, void far * buffer, unsigned len ) ;
;
; Parameters:
;
;
; Returns:
; int AccessDenied (cy=1) 失敗,読み込み禁止
; InvalidHandle(cy=1) 失敗,ファイルハンドルが無効
; else (cy=0) 成功,読み込んだバイト数
;
; Binding Target:
; Microsoft-C / Turbo-C / Turbo Pascal
;
; Running Target:
; PC-9801
;
; Requiring Resources:
; CPU: 8086
;
; Notes:
;
;
; Compiler/Assembler:
; TASM 3.0
; OPTASM 1.6
;
; Author:
; 恋塚(恋塚昭彦)
;
; Revision History:
; 93/ 3/17 Initial: master.lib
;
func DOS_READ
push BP
mov BP,SP
@@fh = (RETSIZE+4)*2
@@buf = (RETSIZE+2)*2
@@len = (RETSIZE+1)*2
push DS
mov BX,[BP+@@fh]
lds DX,[BP+@@buf]
mov CX,[BP+@@len]
mov AH,3fh
int 21h
pop DS
jnc short @@SUCCESS
neg AX ; cy=1
@@SUCCESS:
pop BP
ret 8
endfunc

View File

@ -865,36 +865,7 @@ sub_85E proc far
retf retf
sub_85E endp sub_85E endp
include libs/master.lib/dos_read.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_864 proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_87A
neg ax
loc_87A:
pop bp
retf 8
sub_864 endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -6930,9 +6901,7 @@ loc_389E:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_864
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh

View File

@ -783,36 +783,7 @@ sub_7EA proc far
retf retf
sub_7EA endp sub_7EA endp
include libs/master.lib/dos_read.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_7F0 proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_806
neg ax
loc_806:
pop bp
retf 8
sub_7F0 endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -4055,9 +4026,7 @@ loc_2EBA:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_7F0
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh

View File

@ -769,38 +769,7 @@ loc_7DB:
retf 4 retf 4
sub_7B8 endp sub_7B8 endp
; --------------------------------------------------------------------------- include libs/master.lib/dos_read.asm
nop
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_7E2 proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_7F8
neg ax
loc_7F8:
pop bp
retf 8
sub_7E2 endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -4901,9 +4870,7 @@ loc_3658:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_7E2
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh

View File

@ -770,36 +770,7 @@ sub_7EC proc far
retf retf
sub_7EC endp sub_7EC endp
include libs/master.lib/dos_read.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_7F2 proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_808
neg ax
loc_808:
pop bp
retf 8
sub_7F2 endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -6779,9 +6750,7 @@ loc_3838:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_7F2
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh

View File

@ -757,36 +757,7 @@ sub_7C8 proc far
retf retf
sub_7C8 endp sub_7C8 endp
include libs/master.lib/dos_read.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_7CE proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_7E4
neg ax
loc_7E4:
pop bp
retf 8
sub_7CE endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -4466,9 +4437,7 @@ loc_3040:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_7CE
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh

View File

@ -749,38 +749,7 @@ loc_7B9:
retf 4 retf 4
sub_796 endp sub_796 endp
; --------------------------------------------------------------------------- include libs/master.lib/dos_read.asm
nop
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_7C0 proc far
arg_0 = word ptr 6
arg_2 = dword ptr 8
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push ds
mov bx, [bp+arg_6]
lds dx, [bp+arg_2]
mov cx, [bp+arg_0]
mov ah, 3Fh
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
jnb short loc_7D6
neg ax
loc_7D6:
pop bp
retf 8
sub_7C0 endp
include libs/master.lib/dos_seek.asm include libs/master.lib/dos_seek.asm
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -3984,9 +3953,7 @@ loc_2E78:
push ax push ax
push cx push cx
push di push di
nop nopcall dos_read
push cs
call near ptr sub_7C0
mov es, [bp+var_2] mov es, [bp+var_2]
mov bx, ax mov bx, ax
mov byte ptr es:[bx], 0FFh mov byte ptr es:[bx], 0FFh