Computer Fun 1984: Reviving 20 Marvel Type-In BASIC Programs

#retro#basic#javascript#python

Computer Fun 1984: Reviving 20 Marvel Type-In BASIC Programs

In 1984, Donald I. Fine published Marvel Super Heroes Computer Fun, Book One — a kids’ “type-in BASIC” book where you’d painstakingly key 20 little programs into your Commodore 64, Apple II, IBM PC, or TRS-80, save to cassette, and run. Spider-Man’s tax calculator, Thor’s chain-breaking spell, a Concentration game with the X-Men. I found the book, photographed it page by page, and rebuilt every one of those 20 programs to run in a modern browser (and in any Python 3 terminal) — bugs and all. Claude did the transcribing and translating; I fed it the pages and decided what “faithful” meant.

What it is

The book has 20 programs, and all 20 are done. Each one gets two ports: a self-contained green-CRT browser version (HTML/JS with scanlines and a phosphor-green <pre>) and a zero-dependency Python 3 terminal version. Everything sits behind a shared retro launcher — index.html in the browser, which hosts each program in an iframe, and menu.py in the terminal — so you pick a program by number and run it.

The lineup ranges from autonomous screen toys to real interactive games:

  • Chains of Loki scrolls sine-wave “chains” up the screen; Time Spirals has a turtle fill the screen in spiral order, forever.
  • NIM is a misère subtraction game against the computer; Maze of Doom drops you into an invisible 7×11 maze you’re meant to map on paper.
  • Encoder and Decoder are a matched pair of 5-row columnar transposition ciphers — the decoder unscrambles Iron Man’s message across four lines.
  • Wordweaver turns a name into a binary-pattern textile by decomposing each character’s ASCII into bits.
  • And there are three deliberate debug challengesDisarm Bomb, Flash By, and Broken Calculator — programs the book ships broken on purpose, daring the reader to fix the listing.

Under all 20 sits the book’s own “900-Line” hardware-abstraction shim — a handful of subroutines (GOSUB 900 to clear, GOSUB 910 to print at a cursor, GOSUB 930 for a random int, GOSUB 940 for a keypress) that let one listing target wildly different 1984 machines. I pinned every program to the Commodore 64 screen profile: SW=40, SH=24.

How it was built

The loop was simple and repeated 20 times: the user photographs a page, I transcribe the printed BASIC, then translate it twice — once to JavaScript, once to Python — keeping the on-screen behavior identical to the listing rather than identical to each other.

Translating BASIC faithfully is mostly about not modernizing it. The 900-Line API maps cleanly to small helpers in each file — cls(), put(VT, HT, text), random, keypress — so the body of each program reads almost line-for-line against the book. The C64 profile carries era-accurate quirks I had to honor: INT is a floor, columns are 0-based so the book’s HT-1 indexing has to survive the port, and scrolling programs print on the bottom row and let the screen scroll, while cursor-addressed programs redraw in place. Getting those two rendering models right is the difference between a port that looks like 1984 and one that just runs the same math.

For the structure, each Python program module exposes a reusable play(...) entry point plus an input helper (ask_number, ask_words, and so on) so menu.py can host them uniformly. The interactive browser programs were the fiddly ones — BASIC’s INPUT blocks the whole machine, but a browser can’t block, so the interactive listings (NIM was the first) became small async state machines that emulate a blocking INPUT console without freezing the page.

The retro feel is load-bearing, not decoration. Phosphor green, scanline overlay, a RUN/STOP control, a speed slider where the original timing mattered. The favicon is a green CRT asterisk; the menu screenshot in the README is hand-built SVG; the link-preview image is generated by a small PIL script. No book pages, scans, or artwork are in the repo — every recreation is original code written from the printed listings, with a fair-use note crediting Donald I. Fine Inc., 1984.

The gotchas

Three things bit me, all of them about faithfulness rather than code.

Faithful means shipping the bugs. The instinct when you transcribe broken code is to fix it. That’s the wrong instinct here. Disarm Bomb has a subroutine that ends with END instead of RETURN, so the GOSUB never returns and only the first code ever prints. Broken Calculator is missing the :GOTO 120 after its -, ×, and / branches, so picking subtraction cascades down into the next operator’s code and prints nonsense. The book intends these as debug puzzles (the hint section even points at the bad line). So I ship them buggy-by-default and add a “fix it” toggle, so you can experience the puzzle and then see it work. Even the book’s typos survive: the Challenge Game’s win message keeps “YOU GOT THEN ALL IN.”

Some bugs are unsolvable and you have to make a judgment call. Not every defect is a fun puzzle. The Challenge Game’s LEFT$(...,N*N) only pairs cards correctly at skill level 3 — at other levels the 18-character string caps it and the game breaks outright, with no toggle that makes it interesting. There the clear intent is N*N/2, so I implemented the intent and left a code comment explaining the divergence. The rule I settled on: preserve a bug when it’s the experience (NIM’s suboptimal AI at S÷4, the cascade puzzles), fix it to the obvious intent when the bug just makes the program unusable.

A “too fast to read” program needs an escape hatch. Flash By is a debug challenge that flashes a password one character at a time with a wait loop set so short it’s literally unreadable — the puzzle is to slow line 240 down. Faithfully ported, it’s unsolvable for anyone who doesn’t already know the trick. So the browser version keeps the original behavior but adds a speed slider, and the Python version defaults to a readable 0.40s per character with a --fast flag that restores the original unreadable challenge. Faithful to the listing, but actually solvable.

What shipped

All 20 programs, both ports each — 20 browser HTML files and 20 Python modules, behind one retro CRT menu (index.html and menu.py). The book is done. The project is public on GitHub under MIT, and the menu is live on GitHub Pages — pick a number from 1 to 20 and run a 40-year-old program in your browser.

Credit where it’s due: the original programs were published by Donald I. Fine, Inc. in 1984. My contribution is the faithful modern recreation — transcribing the printed listings, porting them twice, and preserving the quirks instead of polishing them away. There’s a Book Two spec sitting in the repo for whenever I find the second volume.