Traveling 20+ years back in time


Introduction

It is a rare treat to be able to travel 20+ years in the past.

I don’t know if you remember life in ’99. Do you?

I was just graduating from high school, about to go to university. The Y2K craze was in full swing, ICQ was still all the rage, and the Internet was far from common.

And almost all of my personal memories from back then are now rose-colored. Yes, despite only having dial-up modems, terribly slow computers, and only GSM dumb-phones to speak of1.

And I presume I could wax lyrical about the era gone past for quite a while. But today I want to talk about one specific encounter.

About a time capsule I unearthed, in the form of my senior high graduation project: an MS-DOS program to compute parameters of gears toothy wheels.

What on un-earth?

Going through some old CD/DVD archives of mine, I spotted an innocent looking file: zav.arj. Turns out, even in 2022, arj is available in Debian stable.

Just inspecting the file:

$ arj t ~/zav.arj 
ARJ32 v 3.10, Copyright (c) 1998-2004, ARJ Software Russia.

Processing archive: /home/wejn/zav.arj
Archive created: 1999-03-28 19:23:40, modified: 1999-03-28 19:23:40
Testing DOC/USER-FP.HTM             OK        
Testing DOC/TECH-FP.HTM             OK        
Testing DOC/USER.HTM                OK        
Testing DOC/TECH.HTM                OK        
Testing OZUBENI/OZUBENI.EXE         OK        
Testing OZUBENI/INFO.NFO            OK        
Testing OZUBENI/HELP.NFO            OK        
Testing OZUBENI/LATIN2.FNT          OK        
Testing OZUBENI/LOGO.WMG            OK        
Testing SRC/MAKEFILE                OK        
Testing SRC/BEEPS.C                 OK        
Testing SRC/CESTINA.C               OK        
Testing SRC/DOSERR.C                OK        
[...]
Testing SRC/OBJEKTY.H               OK        
Testing SRC/HELP.X                  OK        
Testing SRC/INFO.X                  OK        
Testing SRC/DATA/LATIN2.FNT         OK        
Testing SRC/DATA/LOGO.WMG           OK        
[...]
Testing SRC/UTILS/WASTEMEM.C        OK        
    48 file(s)

brought back a flood of memories.

I couldn’t resist, spun up latest FreeDOS image in VirtualBox and was greeted by the terrifying beauty:

title screen

Back then it was all in Czech, for DOS, and – by today’s standards – trivial2.

But that doesn’t stop me from fondly remembering the hundreds of hours (yes, seriously) I’ve sank into something that could’ve been “phoned in” in just a few hours in the then-typical fashion:

C:\> ozubeni.exe
Ozubeni v. 1.16f

1. Information
2. Calculation
3. End

Enter 1-3: 2

----

1. Using z, m
2. Using D, m
3. Using Da, m
4. Using Df, m
5. Using D, z
6. Using Da, z
7. Using Df, z
8. Go back

Enter 1-8: 1

----

Computation:

Enter m: 1
Enter z: 16

Results:
ha: 1                   hf: 1.25                h: 2.25  
ca: 0.25                D: 16                   Da: 18     
Df: 13.5                t: 3.1416               b: 1.5708
alfa: 20                tb: 2.9521

No warnings/errors.

----

1. Save to file
2. Print result
3. Return to main menu
4. End

Enter 1-4: 4

Thank you for using Ozubeni v. 1.16f

C:\>

And to be fair, that’s a perfectly valid approach that would have netted you a passing grade.

The secret sauce

So what was so special about my little program?3

I happened to hate a few things about plain DOS:

  1. Text-only programs with terrible user experience4
  2. Issues with Czech accents support5
  3. Default MS-DOS I/O errors (“Abort, Retry, Fail”, anyone?)

So I went completely ballistic and wrote a TUI from scratch. Because as an auto-didact I had no idea how the proper TUI in Borland C++ 3.1 worked.

I built in a help screen, arrow-based navigation and form-like screens, error indicators that auto-refreshed, custom I/O handler, custom font driver to eliminate the charset issues, fancy fade-out and fade-in transitions6.

Also – infatuated by HTML – I built a “document” compiler and parser (used on the intro and help screens) that compiled a simple markup (part of help.x):

                                   @fg13@Nápověda@fg--@
 @fg13@Popis ovládání@fg--@
 @fg15@Klávesa:               Význam:@fg--@
 Kurzorové šipky        pohyb mezi položkami
 PgUp / PgDn            stránkování (nápovědy a informací o programu)

into a continuous <char><color> stream (line-adjusted) that was then arrow-scrollable on the 80x25 display area.

But what’s the secret sauce lesson? Because none of this is truly remarkable. It might have a decent level of craftsmanship7. But that’s it.

I think the lesson is this:

If you bang your head against the wall long enough, decent work inevitably pops out.

It probably helped a lot that I was hopelessly in love with computers by that time. And that I didn’t own one. Because constraints tend to have a positive effect on productivity and creativity.

So maybe a second lesson is about the work of love and overcoming obstacles.

In any case, 20+ years later and to my younger self: hey, not bad. :-)

Closing words

If you want to do decent work, go bang your head against a wall for a multitude of hours8. See what comes out.

And on the off chance you want to explore the original beauty, including full source9, here’s zav.arj for you10.

  1. Remember NMT network? Pepperidge farm remembers. But my first phone actually was a Nokia 3210. Beautiful machine. Costly, too. I mean, iPhone SE 2020 kind of costly.

  2. Imma bet you a donut you’d be able to hack up a better version in Javascript in an afternoon.

  3. Apart from me writing it. Me. Me. Meeeee. Bear with me, though?

  4. The DOS ones, though. I truly loved Linux by that point. But nowhere in DOS can one find the pipes, sed, awk, etc. Plus text-interactive programs are the worst.

  5. Back in the day there were two DOS standards for ASCII extended charset (IBM852, DOS-895). And then with Windows there were two more (ISO-8859-2, Windows-1250) before eventually Unicode got adopted… and saved the day (sort of).

  6. That aren’t visible when running in VirtualBox… the whole CPU too fast issue some old DOS games had, I guess.

  7. If you don’t look at the source too closely. And discount it against the circumstances.

  8. And maybe read Pressfield’s The War of Art for inspiration. It’s amazing, mindset-wise.

  9. Maybe skip that part, it’s terrible. :-)

  10. IBM852 encoded, btw. iconv can handle it.