File: explain_HELLO.txt Author: Michael Albaugh Last Modified: 17JUN2014 ($Revision: 1.5 $) This file is an attempt to explain the operation of the one-card "HELLO WORLD" program for the IBM 1401. The program was hand coded and keypunched because it is very simple/short and because I could not coerce my assembler (Van Snyder's Fortran90 implementation of 1401 Autocoder) to produce "raw" output. It insisted I choose one of its available object-deck formats. Anyway, the line below that starts ",008015" is the program itself. The lines below it indicate the column numbers, which in the case of this program are also the storage addresses. Pressing the LOAD button on the 1401 console will cause: 1) storage from 1..80 to be cleared 2) A card to be read into locations 1..80 3) a wordmark [1] to be set in location 1. 4) execution to start at location 1 The first seven instructions are essentially overhead, part of the bootstrap process. /-- set wordmarks at locations 8 and 15 | /-- set wordmarks at 22 and 29 | | /-- set wordmarks, well, you get the point | | | only sets 66 [2] --\ | | | | | | | clear 300..333 -----\ | | | | | | | | clear 200..299 [3] ---------\ | | | | | | | | |move string to buffer [4] ----------\ | | | | | || | | | /-> print ------------------\ | | | / | | || | | | | / eject ------------------\ | | | / | | || || | | | halt, goto print [5] -----------------------\ | | | | | || || | | | +------+------+------+ | | || || | v v v v v v v v vv vv v ,008015,022029,036043,047051,052059,060062,066/333/M0802502F1.059 HELLO, WORLD 12345678901234567890123456789012345678901234567890123456789012345678901234567890 00000000011111111112222222222333333333344444444445555555555666666666677777777778 NOTES: [1] The 1401 and family (1440, 1460, 1410, 7010) are unique in my experience in not only having variable length (delimited) data, but also having variable length delimited instructions. Both data and instructions are delimited by "wordmarks". The opcode must have a wordmark, and fetch continues until another wordmark is seen. The only exception is the "set wordmark" instruction (',') itself, which ends after either 7 characters or a wordmark. The reason is left as an exercise to the reader. [2] A normal "set wordmark" instruction can set them in two locations, specified by two (three digit) addresses, but if there is a wordmark in the character after the first address, only the first address is used. [3] Similarly, if an address is missing from any instruction, it is "chained" (inherited) from the existing contents of that address register. Here, the first "clear storage" ('/') instruction clears location 333, then 332, etc. down to 300, leaving the 'B' address register at 299. The second '/' clears 299, 298, etc. down to 200. [4] The print buffer is hard-wired to locations 201..332. Similarly, the card read buffer is 1..80, and the card punch buffer is 101..180. Later additions of Tape, Disk, and general I/O (for various unusual devices) generalized I/O to take both a unit specifier and buffer address, and the reduced-cost 1440 used this generalized I/O for its card and print I/O as well, resulting in some software compatibility issues. This also meant the 1401 stunt of 'OR'ing the opcodes for read-a-card (1), print (2) and punch (4) to do multiple I/O operations didn't work on the 1440. [5] If a HALT instruction ('.') included an address, the machine would branch to that address when the START button was pressed to step through the halt. Many normally zero- or one- address instructions worked similarly, so one could read, punch, print, and branch in 4 characters ('7' followed by an address). While editting this file to correct typos, I noticed a bug, albeit an innocuous one. Finding it is also left as an exercise to the reader.