Borland's DOS compilers, rebuilt from their own binaries
133 points by frostbyte7 6 hours ago | 47 comments

noahbp 4 hours ago
This is going to be very helpful for any project to decompile binaries that were compiled with these compilers.

I'm working on something similar though shot of a full decompilation for Microsoft Visual C++, to trace and report the knobs to tune in the internal register allocation algorithm (among other things) to make reversing and decompiling binaries that were compiled with MSVC a much easier task: https://github.com/NoahBPeterson/c2scope

reply
ashdnazg 3 hours ago
Nice!

I'm quite far with Microsoft C 5.1, I wonder how much similarity there is, if any.

reply
humblefly 4 hours ago
Sincere question: why? Source like this is a notch better than raw decompiler output in the pre-AI era, but what's the expectation / use case?

    if((ES_B(_BX,MEMB_FLAGS)&3)==3) {
        _DI=ES_W(_BX,MEMB_VALUE);
        _ES=SYMBOL_POOL_SEG;ES_W(0,SYM_TYPE)=base;
        if(ES_W(_DI,SYM_FUNC_KIND)==2) {
            while(!TYPES_COMPATIBLE(TYPE_W(SYM_W(_DI,SYM_TYPE),TYPE_TARGET),TYPE_W(base,TYPE_TARGET),0)) _DI=SYM_W(_DI,SYM_NEXT_OVERLOAD);
        } else {
            while(!SAME_SIGNATURE(SYM_W(_DI,SYM_TYPE),base)) _DI=SYM_W(_DI,SYM_NEXT_OVERLOAD);
        }
        if(_DI==0) {_DI=_DI;goto next_param;}
I grant you that it's a thing you can do with agents, and it's impressive that it works, but once the tokens are spent, what does anyone get out of it? I guess I wonder if AI projects are becoming a bit of a "social proof of money spent".
reply
leobuskin 3 hours ago
That's just wrong usage of agents in this project, many models are capable of reconstructing idiomatic and really close to the original source code with a proper tooling and prompting (I mean, you need to understand what you're doing to get such result). It's sad to see this level of reconstruction with all the resources we have available.
reply
markus_zhang 4 hours ago
I guess AI projects are mostly for individual’s fun. It’s OK.
reply
abalex 3 hours ago
if i have 20 versions of one function to try, i can test all 20 from one script, no DOS. in the Ultima 7 test, all 922 C compiles matched old Borland. ugly code yes, but this part i would use :)
reply
ape4 4 hours ago
Oh, that's basically assembler
reply
AshamedCaptain 4 hours ago
Is it even better than raw decompiler output? Frankly, I have been saying this forever but always criticized: getting C output that compiles has always been the easy part, getting stuff that is readable is actually where the problem is, and franky these "AI decompilers" are hardly an improvement so far.

But people act as if "well we got something that compiles down to the same binary, this must be the actual C source!" Welp. It couldn't be more different than the original source. In fact, it's probably even distracting if your goal is to reconstruct the original source. This is just AI slop in a form that you can't even easily recognize.

Not to mention the licensing aspect of all of this. One should be wary of Watcom because of its terrible license, even though it is technically Open Source.If as a consequence Watcom is kind of a minefield, I don't even know how to start describing this. The trenches at Verdun?

reply
gavinsyancey 8 minutes ago
IMO there are two things that decompiling is useful for:

1. Understanding how the program works. But for this you need a good decompilation, not just "portable assembly in C"

2. Porting to a new platform. Once you have something that builds with a C compiler, you can rebuild it for a different platform, usually more performantly than running in an emulator. And it's often doable (if a lot of work) to also swap out graphics APIs, etc. But I'm not sure there's anyone who would care to run Borland DOS compilers on e.g. apple-aarch64, and DOSbox is more than good enough for anyone who does.

reply
lp4v4n 2 hours ago
Can anyone who knows the mainframe domain explain why legacy COBOL applications are not being aggressively ported to modern java applications? It sounds like an obvious usage of AI to solve a real world problem and yet I barely hear about it.
reply
qak-qskj 2 hours ago
There is no problem. If the COBOL code is stable and works, it works.

You would introduce new problems.

reply
vunderba 11 minutes ago
This. It's very probable that any system still running COBOL has been relatively stable for decades. A lot of these programs are likely used in relatively risk-averse industries (finance, government, etc.) as well.
reply
andsoitis 14 minutes ago
> It sounds like an obvious usage of AI to solve a real world problem

what is the problem that warrants solving?

reply
lp4v4n 3 minutes ago
>what is the problem that warrants solving?

A legacy COBOL code base that runs on expensive and proprietary hardware doesn't sound like a big enough problem?

reply
trollbridge 36 minutes ago
Because Java is much legacy technical debt as COBOL.
reply
hobo123 32 minutes ago
[citation needed]
reply
natas 2 hours ago
You're asking how a watch works!

The truth is that COBOL, particularly on IBM System/390 and z/Architecture, has some rather unusual data representations and capabilities.

For example, PIC 9(18) DISPLAY occupies 144 bits! There are also packed-decimal representations (COMP-3), native decimal arithmetic supported directly by the processor, and other specialized representations. Modern Enterprise COBOL even supports decimal fields of up to 31 digits.

These aren't necessarily exclusive to COBOL or IBM hardware, but the combination of language features, hardware support, and ecosystem integration makes the environment quite distinctive.

And then there's the ecosystem itself. I'm going to keep this deliberately vague for simplicity, but imagine an airline or a bank with millions of lines of COBOL, deeply integrated with databases, transaction processing, messaging, batch systems, and decades of accumulated business logic.

Porting that isn't simply a matter of translating source code. You have to preserve behavior, data representations, transaction semantics, and integrations. Verification alone would be an enormous undertaking. You really don't want to accidentally introduce a rounding error into a banking system or break an airline's reservation system.

Much of this software is also extremely close to the underlying hardware and operating environment. That's part of what makes these systems so difficult to replace.

reply
Jolter 5 minutes ago
I’ll forward a theory that a large proportion of legacy cobol in actual use is already running in an emulated mainframe environment. Which is only to say that the underlying hardware may not play into it as much anymore.

I’d be interested to hear from anyone doing work in this field, if I’m right or not. I only have one personal observation, of an IBM system which was still in use in the 2010’s but the TUI was accessed from a web browser and the execution was (reportedly) in an emulator on a modern PC server.

reply
codazoda 5 hours ago
I've been building a web based editor inspired by the Borland Turbo Pascal/Basic editors. It uses an optional GitHub token to save files directly to your repo. You can try it here:

https://codazoda.github.io/blue

reply
vunderba 14 minutes ago
I have many fond memories of many nights quietly programming under the blue glow of Borland IDEs, to the point where I recreated an almost 1:1 copy of it as a available IDE theme in my ASMR screensaver.

https://hackerman.specr.net

reply
cubano 2 hours ago
I vaguely remember struggling with that old Borland TP editor, so I'm not sure if I am your ideal target audience for that project.

Your post has me trying to remember what editor I used way back then...I remember using Turbo Pascal to quickly whip up a multi-hand blackjack simulator after my very first efforts using MS-BASIC and, of course, after my struggles with the incredibly slow interpreted BASIC, Turbo Pascal seemed like straight witchcraft to me.

I can remember being rather blown away by the raw speed of the Borland editor...this had to be the mid 80's or so. Wow...thinking back about how different everything was back then is really taking me down memory lane. The almost instantaneous compile times were also a wonder after cutting my teeth on my University's time-shared DEC/PDP-10 and it's multi-minute waits.

Since no one in my family or my friends were really into PCs (my dad got an original IBM PC for spreadsheet work with Visicalc and then Lotus123), I had almost no way at all to get any information at all about using the editor or even programming in Pascal...I guess the bookstore and the very expensive programming books that I couldn't afford was how I learned. That and a ton of "crash-n-burn" debugging of course.

Sitting in a bookstore taking notes while reading the books...yeah I guess it really was different back then lol.

reply
saturn_vk 4 hours ago
What’s up with ai titles of the format:

Short description, adjective more description

reply
6581 3 hours ago
"rebuilt" is a past participle in that title, not an adjective.
reply
lloydatkinson 3 hours ago
It's barely an improvement Over Foo Bar: Very long sentence after the colon
reply
Waraqa 4 hours ago
To clarify, 'rebuilt' in the title means reverse-engineered and reconstructed by AI.
reply
muststopmyths 2 hours ago
these kinds of things should be called revibing. I think that expresses what's going on well.
reply
larodi 16 minutes ago
hows it not transpiling really?
reply
krn1p4n1c 3 hours ago
Probably should just be a verb that encapsulates all that now rather than needing clarification.
reply
miah_ 2 hours ago
Vibe Hallucinated
reply
jryle70 30 minutes ago
It's a github repo of someone having fun. Not sure if the submitter is even the author.

Borland was well loved by developers, in case you didn't know what it was. You know what happened if there was no AI? the author wouldn't get around doing this rebuilding.

Wouldn't you spend time doing something more productive than dissing someone's effort? Maybe you have something constructive to criticize?

reply
bartread 2 hours ago
Even the title is written by AI.
reply
ksec 22 minutes ago
This is very disingenuous of them.

I was thinking what does "recovered" meant, did they dig up an old pile of floppy disk? Given Borland still exist as Embarcadero. And what does "rebuilt" meant,

Reverse-engineered and reconstructed by AI could have been the first sentence.

reply
abecedarius 4 hours ago
I'd love to run this for the nostalgia value, and I did buy the original software but left it behind long ago. Oh, well. ("You need the original Borland programs" -- very reasonably.)
reply
jodrellblank 3 hours ago
In the build script:

# 1. download Borland C++ 2.0 and Turbo C 2.01 from WinWorld (links in docs/SETUP.md)

Section 3 here:

https://github.com/abedegno/borland-reborn/blob/main/docs/SE...

(It’s up to your conscience whether it lets you. I have not tried the downloads).

reply
cubano 2 hours ago
Wait...come on now. Do you really think the people who wrote that code care even the tiniest bit if people in 2026 run there code without paying for it?

That would actually be a rather interesting blog post..finding the authors of 80's software and asking them if they still cared about licensing and all that here in the age of AI and modern interwebs.

I would have to say...almost surely not but who knows?

reply
pmkary 2 hours ago
Who would have thought abandonware gets to have a Christmas like this five years ago?
reply
owlstuffing 3 hours ago
Impressive. But the critical missing feature is a step in the process that transforms the resulting source into readable source, using transforms that are provably identical in behavior.
reply
rayiner 3 hours ago
The code is quite readable and well documented. Look at, for example, the register allocator. It’s quite readable what’s going on, and the comment at the top of each file describes the general algorithm.
reply
bazzargh 3 hours ago
it has exactly that step, described in HOW_IT_WORKS:

https://github.com/abedegno/borland-reborn/blob/main/docs/HO...

    6. Make it readable

    With every byte proved, the source was rewritten for people,
    one step at a time, with the full check after each step
(the original has more detail). Whether this step succeeded is a different question.
reply
owlstuffing 2 hours ago
Not really. The source it produces is essentially ASM written in C, not human authored code.
reply
cubano 2 hours ago
Hmmm...sure looks mighty readable to me. Not sure exactly what your complaint about the codebase could be?

My problem seems to be stranger...is anyone else having the Github Unicorn error message popping up everywhere, or is it just me? I am unable to view more than 2 or 3 C files before my review is held up by these rather strange errors.

Its been a little while since I've scanned thru Github...maybe this is a common problem now?

reply
smallerfish 4 hours ago
Watch the use of the word "own" - it's an AI giveaway.
reply
squarefoot 4 hours ago
Since we live in the age of vibe recompilation, reverse engineering etc where everything seems possible, let me drop a wish for a "Turbo Zig" CLI IDE + compiler that covers most well known microcontrollers.
reply
airstrike 2 hours ago
I can tell this is Claude from the title alone
reply
Quitschquat 3 hours ago
Claude usually gives me some bullshit nannying when I try to reverse engineer stuff.
reply
ok123456 3 hours ago
It doesn't take much "intelligence" for RE. Qwen-3.8 is fine for a coarse pass.
reply
motownphilly 3 hours ago
Have you tried Codex? I hear Astra is quite good at RE.
reply
magi-2-ai 2 hours ago
[dead]
reply
theturtle 3 hours ago
[dead]
reply
Tenrion618 4 hours ago
[dead]
reply
Skyfall106 4 hours ago
[dead]
reply
infralog77 6 hours ago
[dead]
reply
supersimpleguy 4 hours ago
[dead]
reply