Mature mainframe madness prints Mandlebrot fractal in TWELVE MINUTES

Welcome back to *kah-zzeeep* the old printer age


A programmer better known for work on Arduino has shown off handy vintage mainframe skills, getting an ancient IBM 1401 to buzz away on its 1403 line printer to produce the classic Mandelbrot fractal image.

It's not as trivial as it sounds. In this blog post on the “12-minute Mandelbrot”, Ken Shirriff explains that programming for the machine, one of two in the Computer History Museum, is more than a bit foreign to the modern computer.

In the case of the 1401, Shirriff was working down-and-dirty in assembly language (even though the unit has a Fortran compiler), and at the processor level, the 1401 used binary coded decimal (BCD) for storage.

In BCD, instead of converting a decimal input (123) into binary (1111011) for storage, each digit of a decimal number (123) is stored and processed as a separate binary representation (0001 followed by 0010 followed by 0011).

“Addresses are in decimal, so storage is in multiples of 1000, not 1024: the system with 16K of memory stores exactly 16,000 characters. All arithmetic is done in base-10. So if you divide two numbers, the IBM 1401 does base-10 long division, in hardware,” Shirriff writes.

In giving his history of the machine, Shirriff recalls that options available over the base lease price of the system let customers buy extra instructions – for example to move records, store registers, and use index registers. That might sound familiar to sysadmins trying to navigate the licensing options of networking kit in which extra ports and speed upgrades to ports come at an extra license fee.

The assembly code he wrote is a little too long to reproduce here, but of course, it had to be run out on punchcards before being fed into the 1401 to run.

Ken Shiriff's Mandelbrot printout, with IBM punch-cards

And it only took 12 minutes ... Ken Shirriff's IBM 1401 Mandelbrot

In the kind of bug that will ring bells with anybody who remembers old dot matrix printers, a hammer failed near the end of the job, causing a white stripe on the image.

Shirriff hopes to get another chance to make a booking on the 1401, perhaps to run off a few thousand digits of Pi. The Computer History Museum's 1401 project is detailed here.

While writing in assembly language is a lot simpler when there's only a tiny amount of memory and a few instructions to work with, your scribe remembers enough of his own experiences with assembly to offer congratulations. ®

Similar topics

Narrower topics


Other stories you might like

Biting the hand that feeds IT © 1998–2022