IBM 1401

From Esolang
Jump to navigation Jump to search

The IBM 1401 is a historical computer announced by IBM in 1959.

Even though it was a real machine used for business purposes, it may be of interest to esolang enthusiasts, due to the unusual (to modern eyes) machine code.

Unlike most modern systems, machine code uses printable characters, with simple mnemonics. It uses decimal arithmetic, and variable word sizes.

Hello world

(Hello world courtesy of http://simh.trailing-edge.com/software.html)

The following would go onto a punched card, and loaded via the LOAD button on the card reader. Each line represents a single card.

,008015,022029,036043,050054,055062,063065,066077/333/M0762502F1.HELLO WORLD

Explanation

Hello world, with memory locations labeled below it:

,008015,022029,036043,050054,055062,063065,066077/333/M0762502F1.HELLO WORLD
00000000011111111112222222222333333333344444444445555555555666666666677777777778
12345678901234567890123456789012345678901234567890123456789012345678901234567890

The card loading process sets a word mark on memory location 1, and clears word marks elsewhere up to location 80. It then reads the card in and starts execution.

Each instruction must be on a word mark, and most instructions must have a word mark afterwards.

, is the set word mark instruction, and in 7 character form, does not need a word mark after it.

,008015 sets a word mark on location 8 and location 15.

,022029 can run because of a word mark set previously, and sets word marks on location 22 and 29.

,036043 sets word marks on locations 36 and 43.

,050054 sets word marks on locations 50 and 54.

,055062 sets word marks on locations 55 and 62

,063065 sets word marks on locations 63 and 65

,066077 sets word marks on locations 66 and 77.

/333 clears memory from location 333 to location 300.

/ uses a register that was set due to the previous /333 to clear from 299 to 200.

M076250 takes the data from 76 down to the next word mark descending (66) and copies it to 250 (going down)

2 prints the contents of memory locations 201-332.

F1 does control carriage 1 (??? is this effectively a newline?)

. halts.

See also