Loading programs in IBM 1401

Programs can be loaded into IBM 1401 from cards, tape or the serial I/O adapter.

Loading programs from cards

To load a program from cards, put the cards in the card reader. Press check reset and start reset on the 1401 console, then press check reset and load on the 1402.

The effect of pressing the load key on the 1402 is to set a word mark in location 1, clear all word marks in locations 2-80, read a card, and branch to location 1.

Since every instruction has to begin with a word mark, the first card loaded has to start setting word marks for the rest of the program on that card. Fortunately, a seven-character set word mark instruction is one of three instructions that do not need to be terminated by a word mark in the next character.

Very simple loader

A very simple loader, used for the diagnostic decks, loads one instruction or data field from each card. Bootstrapping the loader requires a very simple program on the first card:
001        sw   8,12
008        r    1
Which on the first card reads
,0080121001
Each of the next cards loads one instruction or data field:
001        lca  abc,xyz
008        r    1
012 * first character to load
...
abc * last character to load at xyz
which on the card reads
LABCXYZ1001...
The last card clears the read area and branches to the program using a seven-character clear storage and branch instruction:
001        cs   xyz,80
which on the card reads
/xyz080

Autocoder loader format

The Autocoder assembler produces cards in which data to be loaded are in columns 1-39, and instructions to load those data, and set word marks, are in 40-71. Usually, the instruction in 40-46 is a load instruction. Usually, the instructions in 47-67 are set word mark instructions, although sometimes the first one is a clear word mark instruction. Usually the instruction in 68-71 is read a card and branch to 40.

To bootstrap this loader, Autocoder produces the following card:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022029,036040,047054,061068,072/061039              ,0010011040
1      1      1      1      1      1   1      1      1      1      1   1
A simpler one is
....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008047/047046                                ,054061,068072,0010401040
1      1                                      1      1      1      1   1
If a program has overlays, it's useful not to clear the word marks in the read area, so as to be able to continue loading. To enter a portion of a program without clearing the read area, columns 68-71 contain a branch instruction.

The last card has a clear storage and branch instruction in columns 40-47.

This is described in detail on page 51 in the Autocoder assembler reference manual.

Loading programs from tape

To load a program from tape, mount the tape on unit 1 and make it ready, press check reset and start reset on the 1401 console, and then press tape load on the 1401 console.

When the tape load key is pressed, the 1401 reads one record from tape unit 1, with word marks, into location 1, and branches to location 1. It's not necessary to bootstrap this process in the same way as for loading from cards because records can be read from tape with word marks. It may be necessary, however, to provide that one record of the program reads the next one.

Autocoder provides a loader that runs entirely in locations 1-80. The first record clears core:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,200/000H008V0052001L051115L/100099L%U1001R/007199 CLEAR STORAGE
1   1   1   1       1      11      1       1

The second record contains the loader for the remaining records:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
U%U1B.L%U1020RB001L.020
1    11       1    1   1

which is executed beginning in location 7. Subsequent records load data into core, and then load the next record by branching to location 7.

This is described in detail in on page 51 the Autocoder assembler reference manual.

Other formats for loading from cards

The number of ways to load programs from cards is limited only by your imagination. The 1401 Fortran IV compiler uses a format in which word marks are represented on cards by the same character as is used on tape. There is no "read a card with word marks" instruction, so a loader program has to be provided. Here's one:
               job  Alternative boot loader -- uses SBR
               ctl  6611
     *
     * Boot loader.  On each program card
     * CC 1-3 give first address to load.
     * CC 4-5 give number of non-word-separator characters to process.
     * CC 7-70 are characters to be loaded, or word separator
     *         characters 0-5-8 preceding characters to get word marks.
     * Load CS xxx,080 atop read - read&6 to enter program, thus
     *  09907~/xxx080
     * or change the A-address at done&1 - done&3 to enter the program
     * without clearing the read area, thus
     *  13103xxx
     *
     * This runs in 96-199.  The start-up code from 200-218 is cleared.
     *
               sfx  1
               org  96
     k001      dc   001
     read      r
               sbr  move&3,007         Starting from address & 1
     loop      mcw  3,cwsw&3           Move ,,to,, address to cw or sw
               mcw  cw                 Move CW op code to cworsw
               mcw  3                  Move ,,to,, address to move
               s    read,5             Decr count of chars to process
               ma       read-1,003     Bump ,,to,, address
     done      bm   read,5             Read another card if all moved
     move      mcw  0-0,save           Pick up two characters
               mcw  save-1,0-0         Store character, B gets cc 1-3
     cwsw      cw   0-0                Either SW or CW, A gets cc 1-3
     addrs     ma   k001,move&3        Bump from address
               bce  *&5,save-1,~       word separator, 0-5-8
               b    loop               Process next character
               s    save-1             Clobber word separator
               bce  addrs,save,~       word separator, 0-5-8
               mcw  sw,cwsw            Prepare to set WM
               b    move
     cw        cw
     sw        sw
     save      equ  80                 Use cc 79-80 for work
     first     sw   79
               cs
               sw   1,4
               cs   read,*
               xfr  first