r/retrocomputing • u/abedegno • 23d 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.
20
u/saraseitor 23d 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
6
u/suhcoR 23d ago
Interesting. Where does the source code of the Borland C++ 2.0 come from? Reverse engineering from the executable?
5
u/splicer13 22d 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 22d ago
Cool! How did you do it?
2
u/PolicyPopular1349 19d ago
Very good work! Was the Ghidra decompiler used to obtain the source code?
1
u/psykotyk 23d ago
This is really neat.
1
u/Linestorix 21d 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 21d 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).
1
u/66659hi 17d ago
My dad still uses the Brief macros to this day
1
u/joolzg67_b 17d ago
Are you going to do 3.1 as that is what I spent 4 years writing programs with
0
u/cheater00 22d 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.