mirror of https://github.com/nmlgc/ReC98.git
[Reduction] #42: Long shift right
This commit is contained in:
parent
554d0325d5
commit
d5a80ee363
|
@ -0,0 +1,49 @@
|
||||||
|
; *Not* the original file, but an edit to turn it into an includable slice.
|
||||||
|
; Changes include:
|
||||||
|
; * removal of RULES.ASI to eliminate redundancy
|
||||||
|
; * removal of the 'CODE' segment declaration (for obvious reasons)
|
||||||
|
|
||||||
|
;[]-----------------------------------------------------------------[]
|
||||||
|
;| H_LRSH.ASM -- long shift right |
|
||||||
|
;[]-----------------------------------------------------------------[]
|
||||||
|
|
||||||
|
;
|
||||||
|
; C/C++ Run Time Library - Version 5.0
|
||||||
|
;
|
||||||
|
; Copyright (c) 1987, 1992 by Borland International
|
||||||
|
; All Rights Reserved.
|
||||||
|
;
|
||||||
|
|
||||||
|
public LXRSH@
|
||||||
|
public F_LXRSH@
|
||||||
|
public N_LXRSH@
|
||||||
|
|
||||||
|
N_LXRSH@:
|
||||||
|
pop bx ;fix up for far return
|
||||||
|
push cs
|
||||||
|
push bx
|
||||||
|
LXRSH@:
|
||||||
|
F_LXRSH@:
|
||||||
|
cmp cl,16
|
||||||
|
jae @@lsh@small
|
||||||
|
mov bx,dx ; save the high bits
|
||||||
|
shr ax,cl ; now shift each half
|
||||||
|
sar dx,cl
|
||||||
|
;
|
||||||
|
; We now have a hole in AX where the lower bits of
|
||||||
|
; DX should have been shifted. So we must take our
|
||||||
|
; copy of DX and do a reverse shift to get the proper
|
||||||
|
; bits to be or'ed into AX.
|
||||||
|
;
|
||||||
|
neg cl
|
||||||
|
add cl,16
|
||||||
|
shl bx,cl
|
||||||
|
or ax,bx
|
||||||
|
retf
|
||||||
|
@@lsh@small:
|
||||||
|
sub cl,16 ; for shifts more than 15, do this
|
||||||
|
; short sequence.
|
||||||
|
xchg ax,dx ;
|
||||||
|
cwd ; We have now done a shift by 16.
|
||||||
|
sar ax,cl ; Now shift the remainder.
|
||||||
|
retf
|
|
@ -3816,37 +3816,7 @@ __c_exit proc near
|
||||||
retn
|
retn
|
||||||
__c_exit endp
|
__c_exit endp
|
||||||
|
|
||||||
|
include libs/BorlandC/H_LRSH.ASM
|
||||||
; =============== S U B R O U T I N E =======================================
|
|
||||||
|
|
||||||
; Attributes: library function
|
|
||||||
|
|
||||||
N_LXRSH@ proc far
|
|
||||||
pop bx
|
|
||||||
push cs
|
|
||||||
push bx
|
|
||||||
|
|
||||||
LXRSH@:
|
|
||||||
cmp cl, 10h
|
|
||||||
jnb short loc_17F0
|
|
||||||
mov bx, dx
|
|
||||||
shr ax, cl
|
|
||||||
sar dx, cl
|
|
||||||
neg cl
|
|
||||||
add cl, 10h
|
|
||||||
shl bx, cl
|
|
||||||
or ax, bx
|
|
||||||
retf
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
loc_17F0:
|
|
||||||
sub cl, 10h
|
|
||||||
xchg ax, dx
|
|
||||||
cwd
|
|
||||||
sar ax, cl
|
|
||||||
retf
|
|
||||||
N_LXRSH@ endp ; sp-analysis failed
|
|
||||||
|
|
||||||
include libs/BorlandC/__IOERROR.ASM
|
include libs/BorlandC/__IOERROR.ASM
|
||||||
include libs/BorlandC/_isatty.asm
|
include libs/BorlandC/_isatty.asm
|
||||||
|
|
||||||
|
|
38
th02_op.asm
38
th02_op.asm
|
@ -7768,39 +7768,7 @@ _setvect endp
|
||||||
|
|
||||||
include libs/BorlandC/H_LDIV.ASM
|
include libs/BorlandC/H_LDIV.ASM
|
||||||
include libs/BorlandC/H_LLSH.ASM
|
include libs/BorlandC/H_LLSH.ASM
|
||||||
|
include libs/BorlandC/H_LRSH.ASM
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
N_LXRSH@:
|
|
||||||
pop bx
|
|
||||||
push cs
|
|
||||||
push bx
|
|
||||||
|
|
||||||
; =============== S U B R O U T I N E =======================================
|
|
||||||
|
|
||||||
; Attributes: library function
|
|
||||||
|
|
||||||
LXRSH@ proc far
|
|
||||||
cmp cl, 10h
|
|
||||||
jnb short loc_37A4
|
|
||||||
mov bx, dx
|
|
||||||
shr ax, cl
|
|
||||||
sar dx, cl
|
|
||||||
neg cl
|
|
||||||
add cl, 10h
|
|
||||||
shl bx, cl
|
|
||||||
or ax, bx
|
|
||||||
retf
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
loc_37A4:
|
|
||||||
sub cl, 10h
|
|
||||||
xchg ax, dx
|
|
||||||
cwd
|
|
||||||
sar ax, cl
|
|
||||||
retf
|
|
||||||
LXRSH@ endp
|
|
||||||
|
|
||||||
include libs/BorlandC/H_PADD.ASM
|
include libs/BorlandC/H_PADD.ASM
|
||||||
include libs/BorlandC/__IOERROR.ASM
|
include libs/BorlandC/__IOERROR.ASM
|
||||||
include libs/BorlandC/_isatty.asm
|
include libs/BorlandC/_isatty.asm
|
||||||
|
@ -25861,7 +25829,7 @@ loc_C124:
|
||||||
pop bx
|
pop bx
|
||||||
call LXMUL@
|
call LXMUL@
|
||||||
mov cl, 8
|
mov cl, 8
|
||||||
call LXRSH@
|
call far ptr LXRSH@
|
||||||
add ax, [bp+arg_8]
|
add ax, [bp+arg_8]
|
||||||
mov bx, [bp+var_2]
|
mov bx, [bp+var_2]
|
||||||
shl bx, 2
|
shl bx, 2
|
||||||
|
@ -25879,7 +25847,7 @@ loc_C124:
|
||||||
pop bx
|
pop bx
|
||||||
call LXMUL@
|
call LXMUL@
|
||||||
mov cl, 8
|
mov cl, 8
|
||||||
call LXRSH@
|
call far ptr LXRSH@
|
||||||
add ax, [bp+arg_6]
|
add ax, [bp+arg_6]
|
||||||
mov bx, [bp+var_2]
|
mov bx, [bp+var_2]
|
||||||
shl bx, 2
|
shl bx, 2
|
||||||
|
|
Loading…
Reference in New Issue