
Let's compile like it's 1992 (2014) - danso
http://fabiensanglard.net/Compile_Like_Its_1992/
======
kibwen
Let's play the game "Wolfenstein miscompilation or Dwarf Fortress
screenshot?":
[http://fabiensanglard.net/Compile_Like_Its_1992/images/run_w...](http://fabiensanglard.net/Compile_Like_Its_1992/images/run_wolf4.png)

~~~
crowbahr
Def not dorffort

~~~
kenoh
Way too many vermin }, would be detrimental to the fort.

------
jlgaddis
Wow, that Borland IDE UI certainly brings back memories.

Turbo Pascal 6.0 (for DOS) was my first real exposure to programming (not
counting the various BASICs and a short stint learning 6502 assembly) and led
to my teenage self writing a bunch of "IGMs" for Legend of the Red Dragon [0],
a BBS game. Unfortunately, just as I started teaching myself C, I scored a
copy of Visual Basic 3.0 and it was all downhill from there.

It's really cool to see this game I played 20+ years ago and think about how
technology has come. I can't imagine what the next 20 years will bring.

[0]:
[https://en.wikipedia.org/wiki/Legend_of_the_Red_Dragon](https://en.wikipedia.org/wiki/Legend_of_the_Red_Dragon)

~~~
chiph
The language/IDE of choice at college was Turbo Pascal. But then they
introduced Turbo C and I just had to use it for my graphics class (because C
was obviously going to be faster than that Pascal stuff, right?)

Wrong. The Pascal compiler had had years of optimization done to it and their
C compiler was a 1.0 product. My programs ran at half the speed of everyone
else's.

------
douche
If you have a few hours (or days) free, go through the rest of Fabien's source
code reviews and articles. It's fantastic stuff. I really hope he does finish
up the book he's writing on the Wolfenstein 3D engine.

------
Coincoin
No mention of how much time it took to compile? I don't know if my memory is
faulty but I remember Turbo C++ to be much much faster than today's C++
compilers.

~~~
badsectoracula
That is an understatement. That is a full build of my 3D engine -
[http://i.imgur.com/3ApRyuQ.png](http://i.imgur.com/3ApRyuQ.png) (C not C++
but the linked article is also about a C codebase) on my current computer
(4770K i7) under Borland C++ 5.0. Partial builds (modify a file and run) are
instant, which is basically why i'm using it for a lot of my C code (the code
also compiles in other compilers, like OpenWatcom, GCC, Clang, Visual Studio,
Digital Mars C and Pelles C, but i mainly test with GCC, OW and VS, the rest i
only test with occasionally).

The compiler is part of the IDE, not some external process that needs to start
from a blank state for each file, needing to read the same files over and over
(which is what every other "IDE" does these days, similarly with the debugger
which is usually running gdb at the background and some IDEs do not even
bother to perform the builds themselves and instead using cmake or whatever -
honestly it is as if people forgot what the "I" stands for) and it keeps
compiled objects and libraries in memory and even uses the source code
directly from the open windows's text buffers instead of having to save the
file and load it from disk (although it does write the object and executable
files to disk, it just doesn't do the unnecessary roundtrip for compiling the
source).

~~~
laumars
> _The compiler is part of the IDE, not some external process that needs to
> start from a blank state for each file_

I'm pretty sure Borland used to separate out the IDE executables from the
compilers and a couple of other tools tool. I don't have a copy to hand to
prove this but I'm sure I used to occasionally invoke Turbo Pascal's compiler
from the command line outside of the IDE (due to it being a separate .exe /
.com) and I vaguely recall Turbo C++ having a similar design.

I also don't recall build times being _that_ much faster then than they are
now. But maybe that's more a symptom of myself compiling on budget hardware
previously where as I can now afford better spec'ed dev machines (compared to
the market average).

~~~
bluedino
>> I'm pretty sure Borland used to separate out the IDE executables from the
compilers

Turbo C was like that, but not the first few versions of Turbo Pascal.

The whole goal with Turbo Pascal was to have everything in one small program
so you could code/compile/test as fast as possible. It used a one-pass
compiler and didn't have a heavy linker. It was fast even on a 8088. Anders
Hejlsberg was the original author of Turbo Pascal (yes, the same guy from MFC,
J++, C#, TypeScript...)

The original TURBO.COM file was very small. This was great because you could
fit the whole thing on one floppy disk including your own code. No swapping
floppies. Plus it was only $49.95 USD!

Pascal compiled way faster than C because there was less to do. No #includes
to chew through. But Turbo C was even a fast compiler back then. A hundred
thousands of lines per minute according to the ads. Imagine how slow I found
DJGPP and other compilers when I finally moved to 32-bit programming.

~~~
jklowden
Remember, Wirth designed Pascal as a teaching language. One-pass compilation,
no forward declarations, built-in I/O. Turbo Pascal could compile to a .com
file, 64KB max, 16-bit pointers. I'm not sure there was a linker; the first
executable instruction was the first byte in e file.

The neat trick was debugging. Instead of tagging to object code with source-
code line numbers, to break on line N, Turbo Pascal simply recompiled the
source up to line N, and used the size of the output to match the instruction
pointer in the debugged image. Move to next line? Compile one more line, and
stop at the last produced instruction.

But these were tiny programs, written ab initio. No readline, no X, no
network, no database. Hardly any filesystem. To do something akin to
readdir(3) meant writing a bespoke function to call the DOS interrupt. Putting
a menu on the screen required positioning the cursor in the video buffer and
putting each character in successive locations, allowing for the attribute
byte.

If Turbo Pascal was simple, it was also primitive. Much bigger C programs
compile in the blink of an eye today. Complex programs take a long time to
build today, yes. They did then, too.

------
easytiger
There was something about the visceral nature of the tc environment and editor
and toolset that just felt like you were very mentally close to the code you
were writing. Perhaps something about the bare simplicity. I can't help but
feel i've been chasing it ever since in emacs.

~~~
swah
Recently I had to do something I always avoided since it was platform specific
a huge unknown space to me - code something in C#.

It was one of the most pleasurable experiences with "programming" since those
Pascal times, and gave that feeling of being close to the code. I attribute it
to fast compiles, no need for context switching (due to superb
autocompletion), and everything just working well inside the tool.
Documentation was also very good, and the huge API you're exposed gives a
feeling of power (like I felt as a teen with computers, that I could do so
much).

(My recent experience was Python, C (embedded too), Golang, and JS in the
browser.)

~~~
kuschku
> Documentation was also very good, and the huge API you're exposed gives a
> feeling of power (like I felt as a teen with computers, that I could do so
> much).

That’s the reason why C#, or the language it was copied from (Java) are still
popular when performance doesn’t have to be 100% perfect. Easy to use, very
well documented and powerful, and reasonably fast.

------
hunterjrj
Related to all the Pascal discussion in this thread, Carmack actually started
working in Pascal before C:

[https://twitter.com/id_aa_carmack/status/376210391346315264](https://twitter.com/id_aa_carmack/status/376210391346315264)

------
transitorykris
I was super excited to play with this tonight but sadly it appears the Borland
C++ URL is giving 404s.

EDIT: Found Turbo C++ 3.0 and TASM and these work just fine!

~~~
GeertVL
Any links to the correct downloads?

~~~
transitorykris
[https://s3-us-west-2.amazonaws.com/likeits1992/tasm.zip](https://s3-us-
west-2.amazonaws.com/likeits1992/tasm.zip) [https://s3-us-
west-2.amazonaws.com/likeits1992/turboc.zip](https://s3-us-
west-2.amazonaws.com/likeits1992/turboc.zip)

------
chj
I installed tc and built wolf3d from source following the instructions. The
whole process is surprisingly smooth.

------
frozenport
This was an exciting time because you could tune a radio to the clock
frequency to detect crashes!

------
wcummings
I did this with the original xdoom source when I was a teenager. It all
basically works w/ some minor changes. The biggest hurdle is setting up X w/
some goofy color depth.

------
raverbashing
Ah this was very interesting

But sadly Wolf3D is real mode (maybe 16-bit?) and I got accustomed to the
"luxuries" of 32-bit development on DOS under DJGPP

------
coldcode
Screw that lets compile like it's 1981, when I started. Actually, no thank
you.

------
nneonneo
Needs a (2014) tag.

------
ISL
curl? 1992? ;).

