Booting the IBM 1401: How a 1959 punch-card computer loads a program

Interesting details. By Ken Shirriff.

How do you boot a computer from punch cards when the computer has no operating system and no ROM? To make things worse, this computer requires special metadata called “word marks” that can’t be represented on a card. In this blog post, I describe the interesting hardware and software techniques used in the vintage IBM 1401 computer to load software from a deck of punch cards. (Among other things, half of each card contains loader code that runs as each card is read.) I go through some IBM 1401 machine code in detail, which illustrates the strangeness of the 1401’s architecture and instruction set compared to a modern machine.

4 Likes

Not entirely unrelated, Guy Steele’s one-card program for the 1130 (what it is, how it works, and why):
“The Ugliest Program I Ever Wrote” - Guy Steele

2 Likes

I would have thought that the 1401 would use column binary code as well. In the end, it’s all about variable instruction length and wordmarks.
Turns out, there are 4 instructions in total, which do not require a wordmark (WM), if followed by a blank, (and can be used for bootstrapping). Namely, these are:

  • The branch instruction (B) in its 4-character form
    (unconditional jump, just a single address),
  • The set wordmark instruction (,) in its 7-character form
    (sets the WM for two addr. at once)
  • The clear storage instruction (/) in its 7-character form
    (clears a page from given addr. downwards, incl. WMs, continues at second addr.)
  • The branch instruction (B) in its 7-character form
    (conditional jump, comparison to blank)

(Source: Reference Manual, IBM 1401 Data Processing System, correction sheet for p.15)

Notably, the two instructions affecting memory are both setting or clearing the wordmark, while the two others (and the clear instruction, as well) are affecting the program counter. Since this also includes a conditional branch instruction (with comparison), it’s nearly a minimum Turing complete set. (We are missing any instructions to set any memory to anything other than a blank, and any other contents must come from the reader. However, since we can set and clear wordmarks and can outrun the reader doing so, it’s good enough.)

P.S.: Regarding Ken’s question (as posed in the article), whether this is just a clever hack and merely an afterthought or by design, I’d opt for the latter.
(Mind that the 1401 was meant to replace the old punch card appliances and their wire boards. Coming from these, it’s probably rather comfortable and still flexible.)

2 Likes

Interesting follow-up post by Ken Shirriff. The IBM 1401 also implement British currency conversion in hardware.

https://twitter.com/kenshirriff/status/1364365985499602947

50 years ago this month, the UK switched to decimal currency. Before that, there were 12 pence in a shilling and 20 shillings in a pound. This was inconvenient for computers, but the IBM 1401’s Sterling currency option implemented pounds, shillings, and pence math in hardware.

2 Likes

However, I doubt the feasability: those who could afford to lease a 1401 were certainly billing in sovereigns… :wink:

Oh, just look at the complexity here!

From a business perspective, I can see two ways of looking at IBM offering £sd:

  • the sterling compute market, in Britain and the various territories and ex-territories, was worth pursuing as a straightforward commercial decision
  • if they didn’t pursue this market, they can’t dominate it, and it might allow the rise or survival of serious competitors in the world market

And let’s not forget the florin, from 1849, an early attempt at decimalisation and still in use up to 1993, being worth two shillings and therefore a tenth of a pound sterling.

2 Likes

BTW, here’s an about hour long introduction to British coinage (well, it’s that simple :wink: ): Pounds, shillings, and pence: a history of English coinage - YouTube