[Reduction] #517-518: int86

This commit is contained in:
nmlgc 2014-10-01 15:51:50 +02:00
parent 96c4a77d66
commit 399e6e3098
4 changed files with 120 additions and 401 deletions

117
libs/BorlandC/int86.asm Normal file
View File

@ -0,0 +1,117 @@
; int __cdecl int86(int intno, union REGS *inregs, union REGS *outregs)
_int86 proc DIST
@@segp = SREGS ptr -(size SREGS)
@@intno = word ptr (dPtrSize + 2)
@@inregs = DPTR_ (dPtrSize + 4)
@@outregs = DPTR_ (dPtrSize + 4 + dPtrSize)
push bp
mov bp, sp
sub sp, size SREGS
push si
push di
push ss
lea ax, [bp+@@segp]
push ax
nopcall _segread
pop cx
pop cx
push ss
lea ax, [bp+@@segp]
push ax
push word ptr [bp+@@outregs+2]
push word ptr [bp+@@outregs]
push word ptr [bp+@@inregs+2]
push word ptr [bp+@@inregs]
push [bp+@@intno]
call _int86x
add sp, (dPtrSize * 2) + 6
pop di
pop si
mov sp, bp
pop bp
ret
_int86 endp
; int __cdecl int86x(int intno, union REGS *inregs, union REGS *outregs, struct SREGS *segregs)
_int86x proc DIST
@@Code = byte ptr -(4 + 10)
@@Vector = dword ptr -4
@@intno = word ptr (dPtrSize + 2)
@@inregs = DPTR_ (dPtrSize + 4)
@@outregs = DPTR_ (dPtrSize + 4 + dPtrSize)
@@segregs = DPTR_ (dPtrSize + 4 + dPtrSize + dPtrSize)
push bp
mov bp, sp
sub sp, (4 + 10)
push si
push di
push ds
lea cx, [bp+@@Code]
mov word ptr [bp+@@Vector], cx
mov word ptr [bp+@@Vector+2], ss
mov [bp+@@Code], 55h
mov [bp+@@Code+1], 0CDh
mov ax, [bp+@@intno]
mov [bp+@@Code+2], al
mov word ptr [bp+@@Code+3], 0CB5Dh
cmp al, 25h
jb short @@SetRegs
cmp al, 26h
ja short @@SetRegs
mov [bp+@@Code+3], 36h
mov word ptr [bp+@@Code+4], 68Fh
mov word ptr [bp+@@Code+6], cx
mov word ptr [bp+@@Code+8], 0CB5Dh
@@SetRegs:
LDS_ si, [bp+@@segregs]
push [si+SREGS._es]
push [si+SREGS._ds]
LDS_ si, [bp+@@inregs]
mov ax, [si+WORDREGS._ax]
mov bx, [si+WORDREGS._bx]
mov cx, [si+WORDREGS._cx]
mov dx, [si+WORDREGS._dx]
mov di, [si+WORDREGS._di]
mov si, [si+WORDREGS._si]
pop ds
pop es
clc
call [bp+@@Vector]
pushf
pushf
push si
push ds
push es
ife LDATA
mov ds, [bp-20]
endif
LDS_ si, [bp+@@segregs]
pop [si+SREGS._es]
pop [si+SREGS._ds]
LDS_ si, [bp+@@outregs]
pop [si+WORDREGS._si]
pop [si+WORDREGS._flags]
pop [si+WORDREGS._cflags]
and [si+WORDREGS._cflags], 1
mov [si+WORDREGS._di], di
mov [si+WORDREGS._dx], dx
mov [si+WORDREGS._cx], cx
mov [si+WORDREGS._bx], bx
mov [si+WORDREGS._ax], ax
pop ds
jz short @@int86Ok
push ax
push ax
call __IOERROR
pop ax
@@int86Ok:
pop di
pop si
mov sp, bp
pop bp
ret
_int86x endp

View File

@ -4147,139 +4147,7 @@ include libs/BorlandC/xxv.asm
include libs/BorlandC/cputype.asm
include libs/BorlandC/FARHEAP.ASM
include libs/BorlandC/fbrk.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86(int intno, union REGS *inregs, union REGS *outregs)
_int86 proc far
segp = SREGS ptr -8
intno = word ptr 6
inregs = dword ptr 8
outregs = dword ptr 0Ch
push bp
mov bp, sp
sub sp, 8
push si
push di
push ss
lea ax, [bp+segp]
push ax ; segp
nopcall _segread
pop cx
pop cx
push ss
lea ax, [bp+segp]
push ax ; segregs
push word ptr [bp+outregs+2]
push word ptr [bp+outregs] ; outregs
push word ptr [bp+inregs+2]
push word ptr [bp+inregs] ; inregs
push [bp+intno] ; intno
push cs
call near ptr _int86x
add sp, 0Eh
pop di
pop si
mov sp, bp
pop bp
retf
_int86 endp
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86x(int intno, union REGS *inregs, union REGS *outregs, struct SREGS *segregs)
_int86x proc far
var_E = byte ptr -0Eh
var_D = byte ptr -0Dh
var_C = byte ptr -0Ch
var_B = word ptr -0Bh
var_8 = word ptr -8
var_6 = word ptr -6
var_4 = dword ptr -4
intno = word ptr 6
inregs = dword ptr 8
outregs = dword ptr 0Ch
segregs = dword ptr 10h
push bp
mov bp, sp
sub sp, 0Eh
push si
push di
push ds
lea cx, [bp+var_E]
mov word ptr [bp+var_4], cx
mov word ptr [bp+var_4+2], ss
mov [bp+var_E], 55h ; 'U'
mov [bp+var_D], 0CDh ; 'Í'
mov ax, [bp+intno]
mov [bp+var_C], al
mov [bp+var_B], 0CB5Dh
cmp al, 25h ; '%'
jb short loc_3614
cmp al, 26h ; '&'
ja short loc_3614
mov byte ptr [bp+var_B], 36h ; '6'
mov [bp+var_B+1], 68Fh
mov [bp+var_8], cx
mov [bp+var_6], 0CB5Dh
loc_3614:
lds si, [bp+segregs]
push word ptr [si]
push word ptr [si+6]
lds si, [bp+inregs]
mov ax, [si]
mov bx, [si+2]
mov cx, [si+4]
mov dx, [si+6]
mov di, [si+0Ah]
mov si, [si+8]
pop ds
pop es
clc
call [bp+var_4]
pushf
pushf
push si
push ds
push es
lds si, [bp+segregs]
pop word ptr [si]
pop word ptr [si+6]
lds si, [bp+outregs]
pop word ptr [si+8]
pop word ptr [si+0Eh]
pop word ptr [si+0Ch]
and word ptr [si+0Ch], 1
mov [si+0Ah], di
mov [si+6], dx
mov [si+4], cx
mov [si+2], bx
mov [si], ax
pop ds
jz short loc_366A
push ax
push ax
call __IOERROR
pop ax
loc_366A:
pop di
pop si
mov sp, bp
pop bp
retf
_int86x endp
include libs/BorlandC/int86.asm
; =============== S U B R O U T I N E =======================================

View File

@ -3849,139 +3849,7 @@ include libs/BorlandC/xxv.asm
include libs/BorlandC/cputype.asm
include libs/BorlandC/FARHEAP.ASM
include libs/BorlandC/fbrk.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86(int intno, union REGS *inregs, union REGS *outregs)
_int86 proc far
segp = SREGS ptr -8
intno = word ptr 6
inregs = dword ptr 8
outregs = dword ptr 0Ch
push bp
mov bp, sp
sub sp, 8
push si
push di
push ss
lea ax, [bp+segp]
push ax ; segp
nopcall _segread
pop cx
pop cx
push ss
lea ax, [bp+segp]
push ax ; segregs
push word ptr [bp+outregs+2]
push word ptr [bp+outregs] ; outregs
push word ptr [bp+inregs+2]
push word ptr [bp+inregs] ; inregs
push [bp+intno] ; intno
push cs
call near ptr _int86x
add sp, 0Eh
pop di
pop si
mov sp, bp
pop bp
retf
_int86 endp
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86x(int intno, union REGS *inregs, union REGS *outregs, struct SREGS *segregs)
_int86x proc far
var_E = byte ptr -0Eh
var_D = byte ptr -0Dh
var_C = byte ptr -0Ch
var_B = word ptr -0Bh
var_8 = word ptr -8
var_6 = word ptr -6
var_4 = dword ptr -4
intno = word ptr 6
inregs = dword ptr 8
outregs = dword ptr 0Ch
segregs = dword ptr 10h
push bp
mov bp, sp
sub sp, 0Eh
push si
push di
push ds
lea cx, [bp+var_E]
mov word ptr [bp+var_4], cx
mov word ptr [bp+var_4+2], ss
mov [bp+var_E], 55h ; 'U'
mov [bp+var_D], 0CDh
mov ax, [bp+intno]
mov [bp+var_C], al
mov [bp+var_B], 0CB5Dh
cmp al, 25h ; '%'
jb short loc_367C
cmp al, 26h ; '&'
ja short loc_367C
mov byte ptr [bp+var_B], 36h ; '6'
mov [bp+var_B+1], 68Fh
mov [bp+var_8], cx
mov [bp+var_6], 0CB5Dh
loc_367C:
lds si, [bp+segregs]
push word ptr [si]
push word ptr [si+6]
lds si, [bp+inregs]
mov ax, [si]
mov bx, [si+2]
mov cx, [si+4]
mov dx, [si+6]
mov di, [si+0Ah]
mov si, [si+8]
pop ds
pop es
clc
call [bp+var_4]
pushf
pushf
push si
push ds
push es
lds si, [bp+segregs]
pop word ptr [si]
pop word ptr [si+6]
lds si, [bp+outregs]
pop word ptr [si+8]
pop word ptr [si+0Eh]
pop word ptr [si+0Ch]
and word ptr [si+0Ch], 1
mov [si+0Ah], di
mov [si+6], dx
mov [si+4], cx
mov [si+2], bx
mov [si], ax
pop ds
jz short loc_36D2
push ax
push ax
call __IOERROR
pop ax
loc_36D2:
pop di
pop si
mov sp, bp
pop bp
retf
_int86x endp
include libs/BorlandC/int86.asm
; =============== S U B R O U T I N E =======================================

View File

@ -7224,141 +7224,7 @@ loc_496A:
_farcoreleft endp ; sp-analysis failed
include libs/BorlandC/FHEAPCHK.ASM
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86(int intno, union REGS *inregs, union REGS *outregs)
_int86 proc far
segp = SREGS ptr -8
intno = word ptr 6
inregs = dword ptr 8
outregs = dword ptr 0Ch
push bp
mov bp, sp
sub sp, 8
push si
push di
push ss
lea ax, [bp+segp]
push ax ; segp
nopcall _segread
pop cx
pop cx
push ss
lea ax, [bp+segp]
push ax ; segregs
push word ptr [bp+outregs+2] ; segregs
push word ptr [bp+outregs] ; outregs
push word ptr [bp+inregs+2] ; outregs
push word ptr [bp+inregs] ; inregs
push [bp+intno] ; intno
push cs ; intno
call near ptr _int86x
add sp, 0Eh
pop di
pop si
mov sp, bp
pop bp
retf
_int86 endp ; sp-analysis failed
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; int __cdecl int86x(int intno, union REGS *inregs, union REGS *outregs, struct SREGS *segregs)
_int86x proc far
var_E = byte ptr -0Eh
var_D = byte ptr -0Dh
var_C = byte ptr -0Ch
var_B = word ptr -0Bh
var_8 = word ptr -8
var_6 = word ptr -6
var_4 = dword ptr -4
intno = word ptr 4
inregs = dword ptr 6
outregs = dword ptr 0Ah
segregs = dword ptr 0Eh
push bp
mov bp, sp
loc_4C4B:
sub sp, 0Eh
push si
push di
push ds
lea cx, [bp+var_E]
mov word ptr [bp+var_4], cx
mov word ptr [bp+var_4+2], ss
mov [bp+var_E], 55h ; 'U'
mov [bp+var_D], 0CDh ; 'Í'
mov ax, word ptr [bp+inregs]
mov [bp+var_C], al
mov [bp+var_B], 0CB5Dh
cmp al, 25h ; '%'
jb short loc_4C86
cmp al, 26h ; '&'
ja short loc_4C86
mov byte ptr [bp+var_B], 36h ; '6'
mov [bp+var_B+1], 68Fh
mov [bp+var_8], cx
mov [bp+var_6], 0CB5Dh
loc_4C86:
lds si, [bp+segregs+2]
push word ptr [si]
push word ptr [si+6]
lds si, [bp+inregs+2]
mov ax, [si]
mov bx, [si+2]
mov cx, [si+4]
mov dx, [si+6]
mov di, [si+0Ah]
mov si, [si+8]
pop ds
pop es
clc
call [bp+var_4]
pushf
pushf
push si
push ds
push es
lds si, [bp+segregs+2]
pop word ptr [si]
pop word ptr [si+6]
lds si, [bp+outregs+2]
pop word ptr [si+8]
pop word ptr [si+0Eh]
pop word ptr [si+0Ch]
and word ptr [si+0Ch], 1
mov [si+0Ah], di
mov [si+6], dx
mov [si+4], cx
mov [si+2], bx
mov [si], ax
pop ds
jz short loc_4CDC
push ax
push ax
call __IOERROR
pop ax
loc_4CDC:
pop di
pop si
mov sp, bp
pop bp
retf
_int86x endp
include libs/BorlandC/int86.asm
; =============== S U B R O U T I N E =======================================