abedegno/borland-reborn
Borland's DOS compilers, recovered as source that rebuilds the original binaries byte for byte. First up: Borland C++ 2.0's BCC.EXE.
Thành tựu nổi bật
Những danh hiệu mới nhất của dự án
#1 Repository của tuần
#1 Repository của tuần
#1 Repository của tuần
borland-reborn
Borland's DOS compilers, rebuilt from their own binaries.
This repository recovers the source code of classic Borland compilers from the published executables, so that the recovered C and assembly rebuild each executable byte for byte with the original Borland toolchain. Then it makes that source readable: real names, named record fields, comments on every file, and notes on what the compiler does and where it goes wrong.
| Directory | Program | Status |
|---|---|---|
bcc20/ | Borland C++ 2.0 (1991), BCC.EXE, the command-line compiler | Complete: rebuilds byte-identical (SHA-256 dd5744b9...) |
cpp20/ | Borland C++ 2.0 (1991), CPP.EXE, the standalone preprocessor | Complete: rebuilds byte-identical (SHA-256 39879c60...) |
bcc20-port/ | BCC.EXE as a native compiler and library, for decompiling Borland-built games | Complete: every function checked against BCC.EXE; 1874 of 1880 corpus compiles identical; native binaries and a library |
More Borland and Turbo versions will join as further top-level directories, sharing the
scripts/ and the Exhume build tools.
Borland C++ 2.0 at a glance
- 298 sources in 15 subsystem directories: 265 C files (Borland C++ 2.0 and Turbo C 2.01) and 33 hand-written TASM modules. The original's own split into compiled C and hand-written assembly is kept: assembly was never forced into C, and compiled code was never left as assembly.
- Every name is recovered or descriptive: about 3,100 functions, globals and labels, 300
record fields (
src/include/FIELDS.H), 40 record layouts (src/include/RECORDS.H), message, token, type-kind and operator constants. - Every file is documented: a role line, an overview and function comments (about 10,000 lines of comments), with a source map and how the compiler is organised.
- Findings: likely bugs in the original, duplicated code, dead code, and how Borland's
compiler worked inside: bcc20/docs/FINDINGS.md. Some highlights:
the parser is hand-written recursive descent with an operator-precedence expression parser
(no yacc); the code generator's tail merging shaped how the original source had to be
written;
strrchrreads one byte before an empty string; freed precompiled-header file space is never reused.
Rebuild it yourself
You need the original Borland programs (not included: see NOTICE.md). The full guide is docs/SETUP.md; in short:
git clone --recurse-submodules https://github.com/abedegno/borland-reborn
cd borland-reborn
# 1. download Borland C++ 2.0 and Turbo C 2.01 from WinWorld (links in docs/SETUP.md)
python3 scripts/setup-toolchains.py --bc20 "Borland CPP 2.0 (1991) (3.5-720k).7z" --tc201 "<Turbo C 2.01>.7z"
# 2. Python packages and the DOS emulator (dosbox-x), node
python3 -m venv .venv && .venv/bin/pip install -r exhume/tools/requirements.txt
# 3. generate the link inputs from your own BCC.EXE, then compile, verify and link everything
cd bcc20
../.venv/bin/python scripts/prepare.py
../.venv/bin/python ../exhume/tools/gate.py check --all
The last command compiles all 298 sources in DOS, checks every function against the
original byte for byte, verifies every relocation and name, and links a new BCC.EXE that is
identical to Borland's.
To change the compiler, use the modding build. It links the same sources with a layout TLINK chooses, so any function may grow or shrink, new data may go between any two data items, and new source files may be added. It is checked by running 1836 compiles with both compilers (Borland's own example programs and old GCC and cfront tests among them) and comparing every output, with the code and the data moved in several ways and with new and edited files. A tracing emulator shows which words of the data the compiler uses as addresses, and which of its code the tests run: 83% (bcc20/docs/COVERAGE.md). See bcc20/docs/MODDING.md.
How it works
docs/HOW-IT-WORKS.md explains the method: identifying the exact compiler and switches, matching each function, verifying what matching cannot see, linking the whole program with TLINK, and the readability pass that followed, all checked by the same byte-for-byte gate.
Contributing, licence and notice
Corrections to names, comments and findings are welcome: see CONTRIBUTING.md. The project's own scripts and documentation are MIT-licensed (LICENSE). The recovered sources are derived from Borland's copyrighted programs and are provided for study and preservation, with no rights claimed: read NOTICE.md.
Dự án tương tự
Khám phá các dự án và mô hình AI khác có sự tương đồng.
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
🎹🎶 A baremetal kernel that turns your Raspberry Pi 3 or later into a Roland MT-32 emulator and SoundFont synthesizer based on Circle, Munt, and FluidSynth.
What The Function: your AI agent decompiles games you own into C that compiles to the exact same bytes. Runs locally.
A short list of development resources for MS-DOS. Heavily influenced by my own projects and favorites
A collection of various awesome lists for hackers, pentesters and security researchers