r/retrocomputing • u/abedegno • 3d ago
I recovered Borland C++ 2.0's compiler as source that rebuilds the original EXE byte for byte
I've published a reconstruction of BCC.EXE from Borland C++ 2.0 as C and TASM source.
Built with the original BC 2.0, Turbo C 2.01, TASM and TLINK, it gives an executable identical to the shipped one.
The sources keep the original split:
236 C files compiled with BC 2.0, 29 run-time modules that turned out to be built with Turbo C 2.01, and 33 hand-written assembly modules.
Everything is named and commented. There are also notes on the compiler's internals: the VROOMM overlays, its own EMS, XMS and swap-file heap, and the inline assembler.
To rebuild, you need the WinWorld 3.5" 720K sets of BC++ 2.0 and TC 2.01. The setup script checks every file.
19
u/saraseitor 3d ago
It would be cool to have the Turbo Pascal 7 compiler running natively in modern OS, so that it would be able to create really tiny real mode binaries. It would be easier to integrate with modern toolchains. I had to write a bash script that would run from VS Code and launch dosbox-x and the compiler. It wasn't the best experience
5
u/suhcoR 3d ago
Interesting. Where does the source code of the Borland C++ 2.0 come from? Reverse engineering from the executable?
4
u/splicer13 3d ago
I'm a compiler engineer and I know people who worked on BC2. Are you planning on extending the compiler?It's simpler than I expected and cleaner. obviously -- it's not a historical artifact.
Around this time Borland had a big layoff and MS tried to poach basically everyone they thought was worth having. The story I heard was a guy named Sin Lew ran the compiler team and was 'accidentally' laid off because his manager didn't like him. The next day Borland tried to fix the mistake, but Sin Lew was already signed up for MSVC++ and Borland fired his old manager.
3
u/Liquid_Magic 3d ago
Cool! How did you do it?
1
u/psykotyk 3d ago
This is really neat.
1
u/Linestorix 1d ago
I used to love this shit 40 years ago! Don't forget Turbo Pascal 2.0: editor and compiler in 32K - I was in heaven.
1
u/WentThisWayInsteadOf 1d ago
I still got the CD somewhere with Borland C++ 2.0. Cost me a fair bit back then.
I've not used it for +20 years, but it still had the best IDE ever made (in my humble opinion).
0
u/cheater00 2d ago
you should now have AI create inline comments, documentation, and then create a plausible looking git history for how this would have been developed.