Learning Pascal in the Canal Zone

programming nostalgia panama

I found a zip file on a backup drive. pascal.zip, 927 KB, containing every file from my first programming class. Turbo Pascal, Balboa High School, Panama Canal Zone, 1993-1994. I was fifteen.

Balboa was a DODDS school (Department of Defense Dependents Schools) serving American military families stationed at the bases along the Panama Canal. The school closed in 1999 when the U.S. handed the Canal back to Panama under the Torrijos-Carter Treaties. Everything in this archive, the .MIL email addresses, the Panama phone numbers in the BBS dialing directory, the JROTC references, comes from a place that no longer exists in that form.

The archive spans two years: Pascal I starting September 1993, Pascal II ending June 1994. About a hundred source files organized into chapter directories, plus games, a BBS door program, sorting benchmarks, and some documents that have nothing to do with programming but everything to do with being a teenager in Panama in 1994. I’ve preserved the featured files on this site.

The First Program

EX8CH1.PAS, dated September 14, 1993. It calculates the area of a circle:

Program CircleArea (Input, Output);
Uses crt; {Tells the computer to use the monitor}
Begin {main}
  clrscr;
  writeLn ('This program calculates the are of a circle with a radius of 21!');
  write ('The area is');
  writeLn (3.14 * 21 * 21);
  writeLn;
  writeLn ('Please press enter now....');
  readLn {Waits until the computer presses enter}
End.

The comment {Tells the computer to use the monitor} is the kind of thing you write when you have no idea what a uses clause does but your teacher said you need one. The comment on readLn, {Waits until the computer presses enter}, suggests I thought the computer was the one pressing keys. The grading rubric is embedded in the file header: Header 5pts, Program Description 5pts, Presentation 5pts, Run of Program 5pts. Twenty points per assignment, every file stamped with the same template.

Blackjack

By January 1994, Chris Goodno and I built a blackjack game. The first version (GAMESCH3.PAS) was a straightforward text-mode card game. Then we got ambitious. The second version (GAME.PAS) opens with turtle graphics, spirographs drawn with TurnRight and Forwd calls, then switches to Gothic and Triplex fonts for the title screen before dropping into the actual game. Every single line of text output randomizes its color:

textcolor (random(14)+1);
write ('Computer draws: ');
for computer := 1 to cardnum do
  begin {for loop}
    number := random(11) + 1;
    delay (100);
    textcolor ((random(14)+1));
    write (number:2:0,' ');
    counterc := counterc + number;
  end;  {for loop}

The end-of-game messages are the best part. If you lose:

Cash can be paid up front to the disk drive, thank you
Ode to my Winnings   By: C.P.U.

On the outside I look like a sad little computer.
But only if you could see the inside of me....
I would be laughing at your lost....

If you win:

Good Job, now go away so that I may cheat in peace...

The goodbye sequence in the earlier version prints “Thank You For Playing…” one character at a time with delay(200) between each letter, then scatters farewell messages in different languages at random screen positions: “Au Revoire”, “Chow Bombino”, “Adios”, “Hasta Luego”, “Hasta La Bye-bye”, “Syonara”, “Gruss Dis”, “Gutten Tag”, “Salut.” This is what happens when two fifteen-year-olds learn about gotoxy and delay at the same time.

The BBS Door

TRIVIA.PAS in the Chapter 9 directory is not a homework assignment. It’s a BBS door program, a game that runs through a bulletin board system over a modem connection. It uses rmdoor for remote I/O, detects DesqView for multitasking, identifies the CPU type, and reads the caller’s baud rate:

program TriviaDoor (Input, Output, Diskfile);
uses rmdoor, crt, desqview, dos, equipment;

{...}

rmwrite('Your baudrate: ');
rmwritel(baudrate);
rmWriteLn('');
rmsetcolor (3, 0);
rmwrite ('This BBS runs DOS ');
rmwriteLnI (dosversion);
rmWrite('Running on a ');
 Case Processor of
    0: rmWriteLn('What?');
    1: rmWriteLn('8088 or 8086');
    2: rmWriteLn('80186');
    3: rmWriteLn('80286');
    4: rmWriteLn('80386');
    5: rmWriteLn('80486');
    else rmWriteLn('Unknown');
 End;

It has a configuration program (CONFIG.PAS) that supports PCBoard, GAP, SpitFire, RBBS, Wildcat, TriBBS, and WWIV, seven different BBS platforms. The config tool uses a spinning cursor animation while waiting for input, cycling through |, /, -, \. It lets callers both play trivia and submit their own questions, which get appended to a data file with attribution: (Question by: username).

I was running a BBS in Panama at fifteen. The evidence is right there in the code.

The ProComm Dialing Directory

PROCOMM.DIR is a binary dialing directory for ProComm, the terminal program I used to call BBSes. The readable strings reveal the local scene:

  • Huracan por Racsapac, 636641, 1200 baud
  • PCC BBS, 52-4405, 1200 baud
  • Building 861, 86-3862, 1200 baud (a military building number as a BBS name)
  • Panama Jack’s, 864784, 2400 baud
  • PC User’s Group, 696180, 2400 baud
  • Mickey Unix, 52-2013, 2400 baud

Panama phone numbers, 1200 and 2400 baud. This was the entire online world available to me. Each call was a local connection to someone else’s computer, probably in a spare bedroom on one of the bases.

The Email

MATT.DOC is a text file, not a program. It’s an email I wrote, or was preparing to write, from pbaca@DODDS-PANAMA.ARMY.MIL:

Hey what’s up Oscar? I am writing this letter to find out a little bit more about the school you are going to and a little bit more about yourself. I have heard that you are going there on an ROTC scholarship. If so can you tell me a little bit about that. Right now I am considering doing the same thing.

I am heavily into BBS’s at the moment and InterNet is the next step. I am currently a second year cadet in the JROTC program and other than that my main interests are computers. I’m 16 and a Sophomore.

The signature block lists three addresses:

Write to me at pbaca@DODDS-PANAMA.ARMY.MIL
OR at bacap@alpha.acast.nova.edu.  (Care of Paula Boca)
Or at Matt.Michie@f5.n920.z4.fidonet.org
To read next message press CTRL-ALT-DEL

A .MIL address, a borrowed university account, and a FidoNet address. Three different networks, none of which is what we’d recognize as being “online” today. The FidoNet address (zone 4, net 920, node 5) places this squarely in Latin America. Zone 4 covered Central and South America. The CTRL-ALT-DEL sign-off is the kind of joke you make when you’ve been spending too much time around DOS machines.

The Internet Essay

MICHIE.DOC in the TEMP directory is a WordPerfect document, an essay about how the Internet will affect education, written circa 1994:

The Internet has had and will have a great effect on the way information flows in our society. This network of computers passing information swiftly and from many different sources around the world will have a tremendous effect on education.

The Internet allow students to gather information with the minimum of work. This not only helps people make new discoveries that would have taken years of work it allows students to get viewpoints on a topic from anywhere in the world. The Internet will also make learning fun, instead of listening to a lecture for a hour a they could be on-line finding out what’s going on themselves. An example of this would be chatting via E-Mail or conversing real-time with someone from Russia finding out exactly what the conditions are like.

This was written before the World Wide Web was mainstream, before Google, before Wikipedia. A sixteen-year-old in Panama arguing that the Internet would transform education. The predictions are vague in the way that predictions from that era always are. Nobody could have imagined the specific shape it would take. But the core thesis was right.

Sorting Benchmarks

TIMESORT.PAS is something different from the homework. It’s a benchmarking program that compares three sorting algorithms: a Shell sort (PBSort), a Selection sort (KDSort), and a QuickSort. The timing mechanism reads the BIOS tick counter directly from memory:

TickCount : LongInt Absolute $0040:$006C;

Procedure StartTiming;
begin
  TStart := TickCount;
  {start at the beginning of a tick!}
  Repeat Until TStart <> TickCount;
  TStart := TickCount;
end;

The comments contain benchmark results from a 386 running at 33MHz:

     500 Elements - 0.1   Seconds
    1000 Elements - 0.8   Seconds
    1500 Elements - 1.4   Seconds
    2000 Elements - 2.6   Seconds
    3000 Elements - 5.1   Seconds  <- Peak efficiency reached
    5000 Elements - 15.8  Seconds

And the QuickSort results:

     500 Elements - 0.1 Seconds
    1000 Elements - 0.2 Seconds
    1500 Elements - 0.4 Seconds
    2000 Elements - 0.6 Seconds
    3000 Elements - 0.9 Seconds
    5000 Elements - 1.8 Seconds

The commentary is from someone posting in the Pascal echo of FidoNet, discussing how Succ() and Pred() are marginally faster than +1 and -1, how range checking doubles execution time, and how OPRO’s ExchangeLongInts() saves two instructions per iteration. This is the kind of low-level performance obsession that only makes sense when your machine runs at 33MHz and every cycle counts.

Evolution

The most interesting thing about the archive is watching the code change over nine months.

September 1993 (EX8CH1.PAS): no procedures, no variables, hardcoded constants, comments that explain what a monitor is.

April 1994 (EX23CH5.PAS):

procedure SumUp (N:integer;
                 var total:integer);
{Pre: N is assumed to be a positive integer although no checking is done ;) }
{Post: Total is modified to be the sum of all integers up to and including  }
{      the number entered using recursion                                   }
begin {SumUp}
   if n > 0
     then
       begin {if then}
         SumUp (N - 1, total);
         total := total + N;
       end;  {if then}
end;  {SumUp}

Procedures with parameters. Pre and post conditions. Recursion. A winky face in a formal comment. By Chapter 6, there are typed arrays, enumerated types, and proper data structures. The waffle sales tracking program uses a two-dimensional array indexed by an enumerated type:

WaffleType    = (Plain, OatBran, RaisinBran, BlueBerry);
SalesDataType = Array [Min..Month, Plain..BlueBerry] of Integer;

By Chapter 9, there’s file I/O, external libraries, and a real application that talks to modems.

Nine months from {Tells the computer to use the monitor} to writing BBS door software. That’s the arc.

Looking Back

These files survived on a backup drive for thirty-two years. The school that produced them closed in 1999. The BBS phone numbers are long disconnected. FidoNet zone 4 is gone. The .MIL email domain for DODDS-Panama doesn’t exist anymore. The Canal Zone itself was handed back to Panama on December 31, 1999, the same day everyone else was worrying about Y2K.

But the code still reads fine. Pascal is verbose enough to be self-documenting even when the comments are wrong. You can look at GAME.PAS and see exactly what two kids thought was cool in January 1994: turtle graphics, rainbow text, snarky AI dialogue. You can look at TRIVIA.PAS and see someone who’d already outgrown the curriculum, building real software for a real BBS. You can look at MATT.DOC and see a kid trying to bootstrap himself onto the Internet through a borrowed .MIL account and a FidoNet node.

The featured files are here: the programs referenced in this post, the trivia data, the ANSI art, the ProComm dialing directory. It’s not useful code. It was never meant to last. But as a record of how someone learned to program in a place that doesn’t exist anymore, it’s worth keeping.

Discussion