[Reduction] #691: farcoreleft

This commit is contained in:
nmlgc 2014-11-10 19:19:33 +01:00
parent dfc9361b33
commit 6ab63bc2ab
2 changed files with 39 additions and 46 deletions

View File

@ -0,0 +1,38 @@
; unsigned __int32 farcoreleft(void)
_farcoreleft proc
@@value = dword ptr -4
push bp
mov bp, sp
sub sp, 4
push si
push di
mov word ptr [bp+@@value+2], 0
mov word ptr [bp+@@value], 0
mov dx, word ptr _heaptop@+2
mov ax, word ptr _heaptop@
mov cx, word ptr _brklvl@+2
mov bx, word ptr _brklvl@
call N_PSBP@
mov word ptr [bp+@@value+2], dx
mov word ptr [bp+@@value], ax
cmp word ptr [bp+@@value+2], 0
jb short @@ret
ja short @@sub16
cmp word ptr [bp+@@value], 16
jbe short @@ret
@@sub16:
sub word ptr [bp+@@value], 16
sbb word ptr [bp+@@value+2], 0
@@ret:
and word ptr [bp+@@value], 0FFF0h
mov dx, word ptr [bp+@@value+2]
mov ax, word ptr [bp+@@value]
pop di
pop si
mov sp, bp
pop bp
ret
_farcoreleft endp ; sp-analysis failed

View File

@ -1023,52 +1023,7 @@ include libs/BorlandC/cputype.asm
include libs/BorlandC/FARHEAP.ASM
include libs/BorlandC/fbrk.asm
include libs/BorlandC/fcalloc.asm
; =============== S U B R O U T I N E =======================================
; Attributes: library function bp-based frame
; unsigned __int32 farcoreleft(void)
_farcoreleft proc far
var_4 = word ptr -4
var_2 = word ptr -2
push bp
mov bp, sp
sub sp, 4
push si
push di
mov [bp+var_2], 0
mov [bp+var_4], 0
mov dx, word ptr _heaptop@ + 2
mov ax, word ptr _heaptop@
mov cx, word ptr _brklvl@ + 2
mov bx, word ptr _brklvl@
call near ptr N_PSBP@
mov [bp+var_2], dx
mov [bp+var_4], ax
cmp [bp+var_2], 0
jb short loc_496A
ja short loc_4962
cmp [bp+var_4], 10h
jbe short loc_496A
loc_4962:
sub [bp+var_4], 10h
sbb [bp+var_2], 0
loc_496A:
and [bp+var_4], 0FFF0h
mov dx, [bp+var_2]
mov ax, [bp+var_4]
pop di
pop si
mov sp, bp
pop bp
retf
_farcoreleft endp ; sp-analysis failed
include libs/BorlandC/fcorleft.asm
include libs/BorlandC/FHEAPCHK.ASM
include libs/BorlandC/int86.asm
include libs/BorlandC/intdos.asm