diff --git a/libs/BorlandC/f_lxmul.asm b/libs/BorlandC/f_lxmul.asm new file mode 100644 index 00000000..2ee82b89 --- /dev/null +++ b/libs/BorlandC/f_lxmul.asm @@ -0,0 +1,62 @@ +; *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) +; * the @@ prefix on any local labels + +;[]-----------------------------------------------------------------[] +;| F_LXMUL.ASM -- long multiply routine | +;[]-----------------------------------------------------------------[] + +; +; C/C++ Run Time Library - Version 5.0 +; +; Copyright (c) 1987, 1992 by Borland International +; All Rights Reserved. +; +; calls to this routine are generated by the compiler to perform +; long multiplications. + +; There is no check for overflow. Consequently, the same routine +; is used for both signed and unsigned long multiplies. + +; +; in: +; (dx:ax) - 32bit arg1 +; (cx:bx) - 32bit arg2 +; out: +; (dx:ax) - 32bit product +; +; reg use: bx,cx destroyed, all others preserved or contain result. +; +; hi(result) := lo(hi(arg1) * lo(arg2)) + +; lo(hi(arg2) * lo(arg1)) + +; hi(lo(arg1) * lo(arg2)) +; lo(result) := lo(lo(arg1) * lo(arg2)) +; +; + + public LXMUL@ + public F_LXMUL@ + +LXMUL@ PROC FAR +F_LXMUL@: + push si + xchg si,ax ; save lo1 + xchg ax,dx + test ax,ax ; skip mul if hi1==0 + jz @@nohi1 + mul bx ; hi1 * lo2 + +@@nohi1: ; if we jumped here, ax==0 so the following swap works + jcxz @@nohi2 ; skip mul if hi2==0 + xchg cx, ax ; result <-> hi2 + mul si ; lo1 * hi2 + add ax, cx ; ax = hi1*lo2 + hi2*lo1 +@@nohi2: + xchg ax,si + mul bx ; lo1 * lo2 + add dx,si ; hi order result += partials + pop si + ret +LXMUL@ ENDP diff --git a/th01_fuuin.asm b/th01_fuuin.asm index e3c87f3e..d3cd5515 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -3465,33 +3465,7 @@ __dos_setfileattr endp include libs/BorlandC/dosgdriv.asm include libs/BorlandC/errormsg.asm include libs/BorlandC/exit.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -LXMUL@ proc far - push si - xchg ax, si - xchg ax, dx - test ax, ax - jz short loc_1F0F - mul bx - -loc_1F0F: - jcxz short loc_1F16 - xchg ax, cx - mul si - add ax, cx - -loc_1F16: - xchg ax, si - mul bx - add dx, si - pop si - retf -LXMUL@ endp - +include libs/BorlandC/f_lxmul.asm include libs/BorlandC/f_scopy.asm include libs/BorlandC/getvect.asm include libs/BorlandC/H_LDIV.ASM diff --git a/th01_reiiden.asm b/th01_reiiden.asm index c8ad0eab..4b0e1d12 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -4933,33 +4933,7 @@ __dos_setfileattr endp include libs/BorlandC/dosgdriv.asm include libs/BorlandC/errormsg.asm include libs/BorlandC/exit.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -LXMUL@ proc far - push si - xchg ax, si - xchg ax, dx - test ax, ax - jz short loc_2749 - mul bx - -loc_2749: - jcxz short loc_2750 - xchg ax, cx - mul si - add ax, cx - -loc_2750: - xchg ax, si - mul bx - add dx, si - pop si - retf -LXMUL@ endp - +include libs/BorlandC/f_lxmul.asm include libs/BorlandC/f_scopy.asm include libs/BorlandC/getvect.asm include libs/BorlandC/H_LDIV.ASM diff --git a/th02_op.asm b/th02_op.asm index c19baf3b..fc8d31c2 100644 --- a/th02_op.asm +++ b/th02_op.asm @@ -695,33 +695,7 @@ include libs/BorlandC/dosenv.asm include libs/BorlandC/dosgdriv.asm include libs/BorlandC/errormsg.asm include libs/BorlandC/exit.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -LXMUL@ proc far - push si - xchg ax, si - xchg ax, dx - test ax, ax - jz short loc_366B - mul bx - -loc_366B: - jcxz short loc_3672 - xchg ax, cx - mul si - add ax, cx - -loc_3672: - xchg ax, si - mul bx - add dx, si - pop si - retf -LXMUL@ endp - +include libs/BorlandC/f_lxmul.asm include libs/BorlandC/f_scopy.asm include libs/BorlandC/getvect.asm include libs/BorlandC/H_LDIV.ASM