- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
93 lines
2.4 KiB
Plaintext
93 lines
2.4 KiB
Plaintext
/*------------------------------------------------------------------------
|
|
* filename - poly.cas
|
|
*
|
|
* function(s)
|
|
* poly - generates a polynomial from arguments
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
/*
|
|
* C/C++ Run Time Library - Version 6.5
|
|
*
|
|
* Copyright (c) 1987, 1994 by Borland International
|
|
* All Rights Reserved.
|
|
*
|
|
*/
|
|
|
|
|
|
#pragma inline
|
|
#include <asmrules.h>
|
|
|
|
#include <_math.h>
|
|
#include <math.h>
|
|
#include <errno.h>
|
|
|
|
/*--------------------------------------------------------------------------*
|
|
|
|
Name poly - generates a polynomial from arguments
|
|
|
|
Usage double poly(double x, int n, double c []);
|
|
|
|
Prototype in math.h
|
|
|
|
Description poly generates a polynomial in x, of degree n, with
|
|
coefficients c[0], c[1], ..., c[n]. For example, if n=4,
|
|
the generated polynomial is
|
|
|
|
c[4].x^4 + c[3].x^3 + c[2].x^2] + c[1].x + c[0]
|
|
|
|
The polynomial is calculated using Horner's method:
|
|
|
|
polynom = (..((x.c[n] + c[n-1]).x + c[n-2])..).x + c[0]
|
|
|
|
Return value poly returns the value of the polynomial as evaluated for
|
|
the given x.
|
|
If n < 0 then the result is a domain error.
|
|
A range error occurs if the result exceeds double range.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
#pragma warn -use
|
|
double _FARFUNC poly (double x, int n, double c [])
|
|
{
|
|
volatile unsigned sw;
|
|
|
|
asm FLD DOUBLE (x)
|
|
asm mov si, n
|
|
asm mov cl, 3
|
|
asm shl si, cl
|
|
asm or si, si
|
|
asm jl ply_domain
|
|
asm LES_ bx, c
|
|
asm FLD DOUBLE (ES_ [bx+si])
|
|
asm jz short ply_end
|
|
|
|
ply_loop:
|
|
asm FMUL ST, ST(1)
|
|
asm sub si, 8
|
|
asm FADD DOUBLE (ES_ [bx+si])
|
|
asm jg ply_loop
|
|
|
|
ply_end:
|
|
asm FXAM
|
|
asm FSTSW W0 (sw)
|
|
asm FSTP ST(1) /* discard ST(1) */
|
|
asm mov ax, sw
|
|
asm sahf
|
|
asm jc ply_range
|
|
#pragma noretval
|
|
return;
|
|
|
|
ply_domain:
|
|
asm mov si, DOMAIN
|
|
asm jmp short ply_err
|
|
|
|
ply_range:
|
|
asm mov si, OVERFLOW
|
|
|
|
ply_err:
|
|
asm FSTP ST(0) /* discard ST */
|
|
#pragma warn -ret
|
|
return __matherr (_SI, "poly", &x, c, HUGE_VAL);
|
|
#pragma warn .ret
|
|
}
|
|
#pragma warn .use
|