Today a coworker and I were discussing the first programs we ever sold. He and I have been in the business about the same amount of time (right at 30 years), so it was a nostalgic although unfortunately brief discussion.
After dinner this evening, I got to wondering if I still had that program lying around somewhere. Thanks to the magic of multi-terabyte drives and Windows Explorer’s search facility, it was a matter of just a few minutes to locate a copy of that program. Man, I’m a pack rat.
10 'RENUMBER.BAS PROGRAM RENUMBERS BASIC PROGRAMS. BASIC PROGRAM MUST BE SAVED IN ASCII FORMAT OR EDITED WITH A WORD PROCESSOR SUCH AS WORDSTAR.
This was the fall of 1982. I’d left college after two years and was doing odd jobs to get spending money, but mostly I was broke. My friend Dean had a fairly large compiler BASIC program that he had to renumber because … well, that’s what happened to BASIC programs. You thought you put enough space between line numbers and sections, but inevitably you’d get squeezed.
That wasn’t a problem with interpreted BASIC, because there was a RENUM command. No such thing in the compiler BASIC, though, and you couldn’t load the compiler BASIC program into an interpreter because the code didn’t have a line number on every line.
One feature of Microsoft’s compiler BASIC is that not every line needed to be numbered. Only lines that were the targets of GOTO, GOSUB, and other such statements required line numbers.
Dean mentioned this one night and, eager for a challenge (or not smart enough to keep my mouth shut), I said that I’d write him a program to renumber his BASIC program. After all, I’d been writing BASIC programs for three whole years. I’d even taken a few college courses on programming. Of course I could whip this thing out in no time.
I honestly don’t remember how long it took me to write the program. Probably on the order of a week of evenings spent at Dean’s shop standing at one of his computer terminals (a Televideo 950 hooked to a machine running MP/M, supporting four users with a 4 MHz Z-80 processor and a whopping 256 kilobytes of RAM).
The funny thing is that I took on the project as a challenge: something fun to do while spending time with my friend. Dean might have mentioned that he’d pay me for it, and he did when I finished it, but that wasn’t my primary motivation.
I always thought it was funny that I used an interpreted BASIC program to renumber his compiler BASIC source file. In the days before source level debuggers for compiled code, the BASIC interpreter was a much friendlier environment for prototyping things. I probably would have written the program in Pascal if I’d had a compiler for it at the time. The only other language I knew at the time was Z80 assembly, and I wasn’t looking for that much of a challenge.
The program is surprisingly small–less than 400 lines of code. Looking it over brought back some memories. Surprisingly, the code is pretty good. A little difficult to follow, as even small BASIC programs are. But that’s due more to the nature of the language than my meager programming skill at the time. There also are some reasonably mature insights in the code.
More than anything, looking at that code makes me appreciate languages that have real subroutines that require parameters and return values. Calling line numbers (GOSUB) and communicating with globals is terribly difficult to follow. And the language lets you do (sometimes forces you to do) wonky things.
I think I’ll study this code a little more and do something of a code review. Might even post the program here. That should be fun. More next time.