source410: literal 4.10 source reconstruction + BC++ 4.52 fleet toolchain archived

- 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>
This commit is contained in:
Cyd
2026-07-19 07:33:26 -05:00
co-authored by Claude Fable 5
parent 599b2388a1
commit 63312e07f9
5913 changed files with 756089 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
// BARCHART Example Program
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <graphics.h>
#include <math.h>
#include <conio.h>
#define MAX 50
#define ARRAYMAX 10
void makegraph(float p[]);
void main(void)
{
int i;
int scores[ARRAYMAX];
float percents[ARRAYMAX];
for (i = 0; i < ARRAYMAX; i++)
{
printf("\nEnter score between 0 and %d: ", MAX);
scanf("%d", &scores[i]);
}
for (i = 0; i < ARRAYMAX; i++)
percents[i] = ((float) scores[i]) / MAX;
printf("\n\n\n\tSCORE\tPERCENT");
for (i = 0; i < ARRAYMAX; i++)
printf("\n%d. \t%d\t%3.0f", i + 1, scores[i], (percents[i] * 100));
getch();
makegraph(percents);
}
void makegraph(float p[])
{
int g_driver, g_mode;
int i, left, top, wide, bottom, deep;
detectgraph(&g_driver, &g_mode);
initgraph(&g_driver, &g_mode, "..\\..\\bgi");
wide = (int)((getmaxx()) / ((ARRAYMAX * 2 ) + 1));
bottom = getmaxy() - 20;
deep = (int) (wide / 4);
left = wide;
for (i = 0; i < ARRAYMAX; i++)
{
top = (bottom) - ((int)(p[i] * 300));
bar3d(left, top, (left + wide), bottom, deep, 1);
left += (wide * 2);
}
getch();
closegraph();
return;
}


Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
// def.cpp: Implementation of the Definition class
#include <string.h>
#include "def2.h"
void Definition::put_word(char *s)
{
word = new char[strlen(s)+1];
strcpy(word,s);
nmeanings = 0;
}
void Definition::add_meaning(char *s)
{
if (nmeanings < Maxmeans)
{
meanings[nmeanings] = new char[strlen(s)+1];
strcpy(meanings[nmeanings++],s);
}
}
char * Definition::get_meaning(int level, char *s)
{
if (0 <= level && level < nmeanings)
return strcpy(s,meanings[level]);
else
return 0;
}

+23
View File
@@ -0,0 +1,23 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
// def2.h: A word definition class
// from Getting Started
#include <string.h>
const int Maxmeans = 5;
class Definition
{
char *word; // Word being defined
char *meanings[Maxmeans]; // Various meanings of this word
int nmeanings;
public:
void put_word(char *);
char *get_word(char *s) {return strcpy(s,word);};
void add_meaning(char *);
char *get_meaning(int, char *);
friend class Dictionary; // line 18
};


Binary file not shown.
+135
View File
@@ -0,0 +1,135 @@
/*
Copyright (c) 1986,1992 by Borland International Inc.
All Rights Reserved.
*/
#include <errno.h>
#include <string.h>
#include <dos.h>
#include <stdio.h>
int optind = 1; /* index of which argument is next */
char *optarg; /* pointer to argument of current option */
int opterr = 1; /* allow error message */
static char *letP = NULL; /* remember next option char's location */
static char SW = 0; /* DOS switch character, either '-' or '/' */
/*
Parse the command line options, System V style.
Standard option syntax is:
option ::= SW [optLetter]* [argLetter space* argument]
where
- SW is either '/' or '-', according to the current setting
of the MSDOS switchar (int 21h function 37h).
- there is no space before any optLetter or argLetter.
- opt/arg letters are alphabetic, not punctuation characters.
- optLetters, if present, must be matched in optionS.
- argLetters, if present, are found in optionS followed by ':'.
- argument is any white-space delimited string. Note that it
can include the SW character.
- upper and lower case letters are distinct.
There may be multiple option clusters on a command line, each
beginning with a SW, but all must appear before any non-option
arguments (arguments not introduced by SW). Opt/arg letters may
be repeated: it is up to the caller to decide if that is an error.
The character SW appearing alone as the last argument is an error.
The lead-in sequence SWSW ("--" or "//") causes itself and all the
rest of the line to be ignored (allowing non-options which begin
with the switch char).
The string *optionS allows valid opt/arg letters to be recognized.
argLetters are followed with ':'. Getopt () returns the value of
the option character found, or EOF if no more options are in the
command line. If option is an argLetter then the global optarg is
set to point to the argument string (having skipped any white-space).
The global optind is initially 1 and is always left as the index
of the next argument of argv[] which getopt has not taken. Note
that if "--" or "//" are used then optind is stepped to the next
argument before getopt() returns EOF.
If an error occurs, that is an SW char precedes an unknown letter,
then getopt() will return a '?' character and normally prints an
error message via perror(). If the global variable opterr is set
to false (zero) before calling getopt() then the error message is
not printed.
For example, if the MSDOS switch char is '/' (the MSDOS norm) and
*optionS == "A:F:PuU:wXZ:"
then 'P', 'u', 'w', and 'X' are option letters and 'F', 'U', 'Z'
are followed by arguments. A valid command line may be:
aCommand /uPFPi /X /A L someFile
where:
- 'u' and 'P' will be returned as isolated option letters.
- 'F' will return with "Pi" as its argument string.
- 'X' is an isolated option.
- 'A' will return with "L" as its argument.
- "someFile" is not an option, and terminates getOpt. The
caller may collect remaining arguments using argv pointers.
*/
int getopt(int argc, char *argv[], char *optionS)
{
unsigned char ch;
char *optP;
if (SW == 0) {
/* get SW using dos call 0x37 */
_AX = 0x3700;
geninterrupt(0x21);
SW = _DL;
}
if (argc > optind) {
if (letP == NULL) {
if ((letP = argv[optind]) == NULL ||
*(letP++) != SW) goto gopEOF;
if (*letP == SW) {
optind++; goto gopEOF;
}
}
if (0 == (ch = *(letP++))) {
optind++; goto gopEOF;
}
if (':' == ch || (optP = strchr(optionS, ch)) == NULL)
goto gopError;
if (':' == *(++optP)) {
optind++;
if (0 == *letP) {
if (argc <= optind) goto gopError;
letP = argv[optind++];
}
optarg = letP;
letP = NULL;
} else {
if (0 == *letP) {
optind++;
letP = NULL;
}
optarg = NULL;
}
return ch;
}
gopEOF:
optarg = letP = NULL;
return EOF;
gopError:
optarg = NULL;
errno = EINVAL;
if (opterr)
perror ("get command line option");
return ('?');
}


+17
View File
@@ -0,0 +1,17 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
/* HELLO.C -- Hello, world */
#include <stdio.h>
int main()
{
printf("Hello, world\n");
return 0;
}


Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
// list.cpp: Implementation of the List Class
#include <iostream.h>
#include "list2.h"
int List::put_elem(int elem, int pos)
{
if (0 <= pos && pos < nmax)
{
list[pos] = elem;
return 0;
}
else
return -1; // non-zero means error
}
int List::get_elem(int& elem, int pos)
{
if (0 <= pos && pos < nmax)
{
elem = list[pos];
return 0;
}
else
return -1; // non-zero means error
}
void List::print()
{
for (int i = 0; i < nelem; ++i)
cout << list[i] << "\n";
}

+26
View File
@@ -0,0 +1,26 @@
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
// list2.h: A Integer List Class
// from Getting Started
const int Max_elem = 10;
class List
{
protected: // The protected keyword gives subclasses
// direct access to inherited members
int *list; // An array of integers
int nmax; // The dimension of the array
int nelem; // The number of elements
public:
List(int n = Max_elem) {list = new int[n]; nmax = n; nelem = 0;};
~List() {delete list;};
int put_elem(int, int);
int get_elem(int&, int);
void setn(int n) {nelem = n;};
int getn() {return nelem;};
void incn() {if (nelem < nmax) ++nelem;};
int getmax() {return nmax;};
virtual void print(); // line 22
};

+6
View File
@@ -0,0 +1,6 @@
char ss[] = "The restaurant at the end of ";
char *GetString(void)
{
return ss;
}
+1
View File
@@ -0,0 +1 @@
extern char *GetString(void);
+13
View File
@@ -0,0 +1,13 @@
#include <iostream.h>
#include "myfuncs.h"
void main(int argc, char *argv[])
{
char *s;
if(argc > 1)
s=argv[1];
else
s="the universe";
cout << GetString() << s << "\n";
}
Binary file not shown.
+83
View File
@@ -0,0 +1,83 @@
// Borland C++ - (C) Copyright 1991 by Borland International
/* VCIRC.CPP--Example from Getting Started */
// A Circle class derived from Point
#include <graphics.h> // graphics library declarations
#include "vpoint.h" // Location and Point class declarations
#include <conio.h> // for getch() function
// link with vpoint.obj and graphics.lib
class Circle : public Point { // derived from class Point
// and ultimately from class Location
int Radius; // private by default
public:
Circle(int InitX, int InitY, int InitRadius);
void Show(void);
void Hide(void);
void Expand(int ExpandBy);
void Contract(int ContractBy);
};
// Circle constructor calls base Point constructor first
Circle::Circle(int InitX, int InitY, int InitRadius) : Point(InitX,InitY)
{
Radius = InitRadius;
};
void Circle::Show()
{
Visible = true;
circle(X, Y, Radius); // draw the circle using BGI function
}
void Circle::Hide()
{
if (!Visible) return; // no need to hide
unsigned int TempColor; // to save current color
TempColor = getcolor(); // set to current color
setcolor(getbkcolor()); // set drawing color to background
Visible = false;
circle(X, Y, Radius); // draw in background color to erase
setcolor(TempColor); // set color back to current color
};
void Circle::Expand(int ExpandBy)
{
Boolean vis = Visible; // is current circle visible?
if (vis) Hide(); // if so, hide it
Radius += ExpandBy; // expand radius
if (Radius < 0) // avoid negative radius
Radius = 0;
if (vis) Show(); // draw new circle if previously visible
};
inline void Circle::Contract(int ContractBy)
{
Expand(-ContractBy); // redraws with (Radius - ContractBy)
};
main() // test the functions
{
// initialize the graphics system
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\..\\bgi");
Circle MyCircle(50, 100, 25); // declare a circle object
MyCircle.Show(); // show it
getch(); // wait for keypress
MyCircle.MoveTo(100, 125); // move the circle (tests hide
// and show also)
getch();
MyCircle.Expand(25); // make it bigger
getch();
MyCircle.Contract(35); // make it smaller
getch();
closegraph();
return 0;
}

Binary file not shown.
+52
View File
@@ -0,0 +1,52 @@
// Borland C++ - (C) Copyright 1991 by Borland International
/* VPOINT.CPP--Example from Getting Started */
// VPOINT.CPP contains the definitions for the Point and Location
// classes that are declared in the file vpoint.h
#include "vpoint.h"
#include <graphics.h>
// member functions for the Location class
Location::Location(int InitX, int InitY) {
X = InitX;
Y = InitY;
};
int Location::GetX(void) {
return X;
};
int Location::GetY(void) {
return Y;
};
// member functions for the Point class: These assume
// the main program has initialized the graphics system
Point::Point(int InitX, int InitY) : Location(InitX,InitY) {
Visible = false; // make invisible by default
};
void Point::Show(void) {
Visible = true;
putpixel(X, Y, getcolor()); // uses default color
};
void Point::Hide(void) {
Visible = false;
putpixel(X, Y, getbkcolor()); // uses background color to erase
};
Boolean Point::IsVisible(void) {
return Visible;
};
void Point::MoveTo(int NewX, int NewY) {
Hide(); // make current point invisible
X = NewX; // change X and Y coordinates to new location
Y = NewY;
Show(); // show point at new location
};
+34
View File
@@ -0,0 +1,34 @@
// Borland C++ - (C) Copyright 1991 by Borland International
/* vpoint.h--Example from Getting Started */
// version of point.h with virtual functions for use with VCIRCLE
// vpoint.h contains two classes:
// class Location describes screen locations in X and Y coordinates
// class Point describes whether a point is hidden or visible
enum Boolean {false, true};
class Location {
protected: // allows derived class to access private data
int X;
int Y;
public: // these functions can be accessed from outside
Location(int InitX, int InitY);
int GetX();
int GetY();
};
class Point : public Location { // derived from class Location
// public derivation means that X and Y are protected within Point
protected:
Boolean Visible; // classes derived from Point will need access
public:
Point(int InitX, int InitY); // constructor
virtual void Show();
virtual void Hide();
Boolean IsVisible();
void MoveTo(int NewX, int NewY);
};