[Reduction] #81: ioctl

This commit is contained in:
nmlgc 2014-08-20 13:40:14 +02:00
parent b90a1e2320
commit f39d9165da
4 changed files with 51 additions and 152 deletions

42
libs/BorlandC/ioctl.asm Normal file
View File

@ -0,0 +1,42 @@
; int ioctl(int fd, int func, void *argdx, int argcx)
public _ioctl
_ioctl proc DIST
handle = word ptr 6
_func = word ptr 8
argdx = dword ptr 0Ah
argcx = word ptr 0Eh
push bp
mov bp, sp
push si
push di
push ds
lds dx, [bp+argdx]
mov ah, 44h
mov al, byte ptr [bp+_func]
mov bx, [bp+handle]
mov cx, [bp+argcx]
int 21h
pop ds
jb short @@ioctlFailed
cmp [bp+_func], 0
jnz short @@ioctlRetJump
mov ax, dx
jmp short @@ioctlRet
; ---------------------------------------------------------------------------
@@ioctlRetJump:
jmp short @@ioctlRet
; ---------------------------------------------------------------------------
@@ioctlFailed:
push ax
call __IOERROR
@@ioctlRet:
pop di
pop si
pop bp
ret
_ioctl endp

View File

@ -7730,52 +7730,7 @@ loc_36FE:
retf
_intdosx endp
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int ioctl(int handle, int func, ...)
_ioctl proc far
handle = word ptr 6
func = word ptr 8
arg_4 = dword ptr 0Ah
arg_8 = word ptr 0Eh
push bp
mov bp, sp
push si
push di
push ds
lds dx, [bp+arg_4]
mov ah, 44h ; 'D'
mov al, byte ptr [bp+func]
mov bx, [bp+handle]
mov cx, [bp+arg_8]
int 21h ; DOS - 2+ - IOCTL -
pop ds
jb short loc_3727
cmp [bp+func], 0
jnz short loc_3725
mov ax, dx
jmp short loc_372B
; ---------------------------------------------------------------------------
loc_3725:
jmp short loc_372B
; ---------------------------------------------------------------------------
loc_3727:
push ax
call __IOERROR
loc_372B:
pop di
pop si
pop bp
retf
_ioctl endp
include libs/BorlandC/ioctl.asm
; ---------------------------------------------------------------------------
push ax
@ -11097,8 +11052,7 @@ loc_4AE8:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
pop cx
pop cx
mov [bp+var_4], ax
@ -11116,8 +11070,7 @@ loc_4AE8:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
add sp, 8
jmp short loc_4B46
; ---------------------------------------------------------------------------

View File

@ -7551,53 +7551,7 @@ loc_3766:
retf
_intdosx endp
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int ioctl(int handle, int func, ...)
_ioctl proc far
handle = word ptr 6
func = word ptr 8
arg_4 = dword ptr 0Ah
arg_8 = word ptr 0Eh
push bp
mov bp, sp
push si
push di
push ds
lds dx, [bp+arg_4]
mov ah, 44h ; 'D'
mov al, byte ptr [bp+func]
mov bx, [bp+handle]
mov cx, [bp+arg_8]
int 21h ; DOS - 2+ - IOCTL -
pop ds
jb short loc_378F
cmp [bp+func], 0
jnz short loc_378D
mov ax, dx
jmp short loc_3793
; ---------------------------------------------------------------------------
loc_378D:
jmp short loc_3793
; ---------------------------------------------------------------------------
loc_378F:
push ax
call __IOERROR
loc_3793:
; _ioctl:loc_378Dj
pop di
pop si
pop bp
retf
_ioctl endp
include libs/BorlandC/ioctl.asm
; ---------------------------------------------------------------------------
push ax
@ -11328,8 +11282,7 @@ loc_4DCA:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
pop cx
pop cx
mov [bp+var_4], ax
@ -11347,8 +11300,7 @@ loc_4DCA:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
add sp, 8
jmp short loc_4E28
; ---------------------------------------------------------------------------

View File

@ -11425,53 +11425,7 @@ loc_4D70:
retf
_intdosx endp
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int ioctl(int handle, int func, ...)
_ioctl proc far
handle = word ptr 6
func = word ptr 8
arg_4 = dword ptr 0Ah
arg_8 = word ptr 0Eh
push bp
mov bp, sp
push si
push di
push ds
lds dx, [bp+arg_4]
mov ah, 44h ; 'D'
mov al, byte ptr [bp+func]
mov bx, [bp+handle]
mov cx, [bp+arg_8]
int 21h ; DOS - 2+ - IOCTL -
pop ds
jb short loc_4D99
cmp [bp+func], 0
jnz short loc_4D97
mov ax, dx
jmp short loc_4D9D
; ---------------------------------------------------------------------------
loc_4D97:
jmp short loc_4D9D
; ---------------------------------------------------------------------------
loc_4D99:
push ax
call __IOERROR
loc_4D9D:
pop di
pop si
pop bp
retf
_ioctl endp
include libs/BorlandC/ioctl.asm
; =============== S U B R O U T I N E =======================================
@ -14826,8 +14780,7 @@ loc_6140:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
pop cx
pop cx
mov [bp+var_4], ax
@ -14845,8 +14798,7 @@ loc_6140:
push ax ; func
push [bp+handle] ; handle
nop
push cs
call near ptr _ioctl
call _ioctl
add sp, 8
jmp short loc_619E
; ---------------------------------------------------------------------------