In the beginning of Terminator 2: Judgement Day, John Connor uses a laptop to crack the PIN of a stolen debit card.

I don’t think I saw Terminator 2 in the theater. I probably watched it years later on LaserDisc but the scene left quite an impression on me. I had a similar reaction to the war dialer in WarGames and the black box in Sneakers.

War Dialer in WarGames (1983)
War Dialer in WarGames (1983)
Black Box in Sneakers (1992)
Black Box in Sneakers (1992)

Anyways, I was thinking about that scene from Terminator 2 recently which led me to googling, “What’s that laptop in Terminator 2?”

It’s an Atari Portfolio, the world’s first palmtop computer. It was released in June 1989.

Atari Portfolio

It had a monochrome LCD with 240x64 pixels or 40 characters x 8 lines and ran off 3 AA batteries.

The next thing I wondered was, “How difficult would it be to write that program?” Not a program that actually cracks PIN numbers from debit cards, I don’t think you can actually do that with a serial cable and some aluminum foil wrapped around a debit card, but a program that can simulate the output of the palmtop in that scene.

Let’s gather some product requirements!

If we watch the video again, the first thing that happens is that it displays a banner for the program.

banner

The image is clear enough that you can copy the banner easily.

PPPPP   IIIIIII   N    N
P   PP     I      NN   N IDENTIFICATION
P   PP     I      N N  N
PPPPP      I      N  N N   PROGRAM
P          I      N   NN
P       IIIIIII   N    N

Strike a key when ready ...

At this point, John hits Enter and the numbers start scrolling. If we look a few frames in:

first line

We can see that the first line of numbers is:

12345678901234567890123457890123456780

One might assume that this is just the digits 1 through 0 repeated four times, but upon closer look, it’s only 38 digits long. In the third set, the number 6 is omitted, and the last set, the number 9 is omitted.

The way the numbers decrease isn’t obvious either, but it seems like it prints about 5 lines at a certain length before decreasing the length by 1, but after the next set it decreases the length by 2 and then alternates back and forth until it identifies the 4-digit PIN code and dumps him back to a prompt.

Well, that seems pretty straightforward. I’ve been trying to get better at Python so here’s a script I wrote in Python 3:

#!/usr/bin/env python3
import time
import random

delay = 0.025

print("PPPPP   IIIIIII   N    N")
time.sleep(delay)
print("P   PP     I      NN   N IDENTIFICATION")
time.sleep(delay)
print("P   PP     I      N N  N")
time.sleep(delay)
print("PPPPP      I      N  N N   PROGRAM")
time.sleep(delay)
print("P          I      N   NN")
time.sleep(delay)
print("P       IIIIIII   N    N")
time.sleep(delay)

print('')
input("Strike a key when ready ...")

print("\n\n12345678901234567890123457890123456780")

lines = 1

length = 38
decrease = 1
while True:
    for i in range(0, length):
        print(random.randint(0,9), end='')
    print('')
    time.sleep(delay)
    lines += 1
    if (lines == 5):
        lines = 0
        length -= decrease
        if (decrease == 1):
            decrease = 2
        else:
            decrease = 1
    if (length <= 4):
        break
for i in range(0, 10):
    print("9003")

print("\nPIN IDENTIFICATION NUMBER: 9003")

print("\na>", end='')

The script runs really quickly so I added a delay between lines so that you can see the same progression as in the clip. I’m sure there are other optimizations that can be made, but if I were administering this as a bad coding challenge for a tech interview, I’d pass myself.

Using Google Image Search, I found a site selling OEM plastic bezels for the Atari Portfolio which had this nice graphic of the front of the screen:

screen bezel

After playing around with termtosvg a bit, in particular the SVG templates feature, I managed to produce this crazy SVG:

Despite running html5zombo.com for over 10 years now, I’m not sure I really appreciated what SVGs were capable of until I built this one. They can embed images? CSS? Javascript? Any site that allows users to upload arbitrary SVGs and renders them now has my utmost respect.

While I enjoyed making my little self-contained SVG, it bugged me that my Python code could never actually run on an Atari Portfolio. The Atari Portfolio runs “DIP Operating System 2.11” (DIP DOS) which is “mostly compatible” with MS-DOS.

In junior high, before anybody paid me to write software professionally, I used to write BBS software, mods, and door games in my spare time in a mix of Turbo Pascal and a scripting language called PCBoard Programming Language which was similar to BASIC. Based on my minimal research, if I could write this in Turbo Pascal and compile it, it’d probably run on an Atari Portfolio.

I haven’t written Turbo Pascal in about 25 years, but do you ever really forget?

I like a fork of DOSBox called DOSBox-X, so I downloaded and installed the most recent SDL2 variant for OS X. Then I found a copy of Borland Turbo Pascal 7.0, which I’ll put here because it was kind of a pain to find.

You’ll find 4 files in that ZIP which are images of floppy disks. If you put them in a directory like ~/tp, after you start DOSBox-X and mount a C Drive, you can mount them to the A Drive like this:

imgmount a ~/tp/Disk01.img ~/tp/Disk02.img ~/tp/Disk03.img ~/tp/Disk04.img -floppy

and then switch over to the A: drive and run INSTALL:

A:
INSTALL

turbo pascal install

turbo pascal install

turbo pascal install

turbo pascal install

At some point in the installation, you’ll have to change floppy disks, because it’s 1992.

turbo pascal install

You can do this by selecting Drive -> A -> Swap disk in DOSBox-X. It’ll go from Disk 1 to Disk 2. Then just keep doing that and pressing enter until you’ve installed all four disks.

After the installation is done, it’ll ask you to configure your CONFIG.SYS and AUTOEXEC.BAT because again, 1992.

turbo pascal install

Neither of these are strictly necessary. DOSBox-X already sets the FILES higher than the recommendation and adding it to the path only really lets you run TURBO from anywhere. When it’s done, you can run:

C:
cd tp\bin
TURBO

turbo pascal

turbo pascal

I’d spent so much time looking at this IDE when I was a kid that it made me a bit nostalgic. But then I started porting my Python script to Pascal and that nostalgia faded quickly. I’d like to say that I wrote the whole thing in here but at a certain point I had to switch to VSCode and then copy the file back into the DOS directory. To the people that still run WordPerfect for DOS, I get it, but I also don’t get it.

Here’s the script I landed on after spending a lot of time on this Pascal tutorial:

program pinid;
uses crt;

var i: byte;
var pos: byte;
var lines: byte;
var length: byte;
var decrease: byte;
var delay_amount: integer;

begin
     randomize;

     delay_amount := 25;

     clrscr;

     writeln('PPPPP   IIIIIII   N    N');
     delay(delay_amount);
     writeln('P   PP     I      NN   N IDENTIFICATION');
     delay(delay_amount);
     writeln('P   PP     I      N N  N');
     delay(delay_amount);
     writeln('PPPPP      I      N  N N   PROGRAM');
     delay(delay_amount);
     writeln('P          I      N   NN');
     delay(delay_amount);
     writeln('P       IIIIIII   N    N');
     delay(delay_amount);
     writeln('');

     write('Strike a key when ready ...');
     readln;

     writeln('');
     writeln('');
     writeln('12345678901234567890123457890123456780');

     pos := 0;
     lines := 1;

     length := 38;
     decrease := 1;

     while true do
     begin
          for i:= 1 to length do 
               write(random(9));
          writeln('');
          delay(delay_amount);
          lines := lines + 1;
          if (lines = 5) then
          begin
               lines := 0;
               length := length - decrease;
               if (decrease = 1) then
                   decrease := 2
               else
                   decrease := 1;
          end;
          if (length <= 4) then
               break;
     end;

     for i:= 1 to 10 do
     begin
          writeln('9003');
          delay(delay_amount);
     end;

     writeln('');
     writeln('PIN IDENTIFICATION NUMBER: 9003');
     writeln('');

end.

Some quick explanations:

  • Pascal has type declarations. A byte can be a number from 0-255.
  • files start with program and the name of the program, presumably because all modules share the same namespace but the filename is irrelevant
  • modules are imported with the word uses. crt is a module for manipulating the screen
  • := is the syntax for variable assignment, so you can compare with = and differentiate between the two.
  • If blocks are longer than one line, you have to wrap them with begin and end instead of brackets or relying upon whitespace.
  • If you don’t run randomize at the beginning of your script, hilariously it always seeds random numbers with the same seed and the output is the same.
  • WRITE writes a string, WRITELN writes a string with a newline. READLN accepts input until a newline is received.

Does it work? Here’s the program running in DOSBox-X:

In the spirit of owning less stuff, I’ve gone through the mental exercise of what it would take to make the rest of this a reality but will not follow through on any of it:

  1. Buy an Atari Portfolio on Ebay.
  2. Buy an Atari Portfolio parallel interface and probably a new screen bezel because it’s likely scratched.
  3. Find a parallel cable in my box of cables.
  4. Find a PC or laptop with a parallel port, install MS-DOS v6.22 on it.
  5. Download FT.COM and put it on the PC.
  6. Build the EXE in Dosbox-X and transfer it to the Atari Portfolio.
  7. Steal a debit card.
  8. Wrap part of the card in aluminum foil, buy an Atari Portfolio serial interface, run a cable to the card.
  9. Run the program.
  10. Easy money!