I've been studying and fooling with the IBM 1401 clear storage and
bootstrap sequence for Autocoder-format decks.  I wrote a few new ones.

=======================================================================

0. Here's a one-card bootstrap-only loader (see #12):

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022047/047046        BOOTSTRAP        ,054061,068072,0010401040

If it turns out that clear storage and branch actually doesn't need
a word mark after it, this can be simplified:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008047/047046               BOOTSTRAP        ,054061,068072,0010401040

=======================================================================

1.  Here is the clear storage and bootstrap routine emitted by
Autocoder for 16k 1401 machines.

The lines with 1's, 2's and 3's indicate where word marks are or will
be.  1 indicates a word mark in the read area.  2 indicates a word mark
in code that gets loaded elsewhere.  3 indicates a word mark that
serves both purposes (it gets copied from the read area by an L
instruction).

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030037,044,049,053053N000000N00001026
1      1      1      1   1   1      1      1    1   1
L068116,105106,110117B101/I9I#071029C029056B026/B001/0991,001/001117I0?
1      1      1      1   1   1      1      1    1   3   22   2      2
,008015,022029,036040,047054,061068,072/061039              ,0010011040
1      1      1      1      1      1   1      1      1      1      1   1

Here is the clear storage and bootstrap routine emitted by Autocoder
for 4k 1401 machines.  4 indicates a transient word mark (gets set and
cleared). This is used to subtract 100 from the address.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019026,030,034041,045,053,0570571026
1      1      1   1      1   1   1      1   1       1   1
L068112,102106,113/101099/I99,027A070028)027B0010270B0261,001/001113I0
1      1      1   1      14  1   1      1   1       1   32   2      2
,008015,022029,036040,047054,061068,072/061039              ,0010011040
1      1      1      1      1      1   1      1      1      1      1   1

=======================================================================

2.  Here is the clear storage and bootstrap routine emitted by the
SPS-1 or -2 assembler for a 4k machine.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70...
,008015,022026,030034,041,045,053,0570731026
1      1      1      1   1   1   1      1   1       1   1               1
L072116,110106,105117B101/I99,027A074028)027B0010270B026/0991,001/001117I0
1      1      1      1   1   1   1      1   1       1   1               1
,008015,022029,056063/056029                           ,0240671056
2      2      2      2 4    2                          1      1   1

=======================================================================

3.  Here is the clear storage and bootstrap routine emitted by the
Fortran compiler.  Notice that it uses SBR.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030037,044,049,053034,035036N00001026
1      1      1      1   1   1      1      1    1   1
L068116,105106,110117B101/I9ZH029NNNC029056B026/B001/0991,001/001117I0+
1      1      1      1   1   1   1111      1    1   1
,008015,022029,036040,047054,061068,072/061039              ,0010011040
1      1      1      1      1      1   1      1      1      1      1   1

=======================================================================

Here are some clear storage and bootstrap routines for IBM 1401, that
are different from what the Autocoder assembler emitted.

=======================================================================

4.  This one works similarly to #1, but is "more efficient" (as if that
mattered) by moving the word mark that isn't needed at 117 (because
clear-storage-and-branch doesn't need a word mark at the next
character) to 201, and then checking for it instead of comparing
addresses.  It also uses my favorite bootstrap card:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019023,027,034,042,046201N00000001023
1      1      1   1   1   1      1       1   1
L062116,105106,110B101/I9I#064026V0232011B001/0991,001/001199I0?
1      1      1   1   1   1      1       1   3   22   2
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

The bootstrap card can be generated as an ordinary "load card"
by Autocoder (but it will produce warnings about junk in 1-80):

     * BOOTSTRAP CARD
               ORG  1                               0001
               SW   8,47                  7  0001  , 008 047
               DC   @/047046@  CS 47,46   7  0014
               DC   #15                  15  0029
               DC   @BOOTSTRAP@           9  0038
               ORG  54                              0054
               DA   1X19                     0054   0072
                    8,14                     0061
                    15,28                    0068
                    19,19                    0072
               ORG  1
               DA   1X40                     0001   0040
                    40,40                    0040

You could put more of them anywhere in the deck, and nothing would
happen.

Here's a clear core and bootstrap in the same spirit, but a bit shorter:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019023,027034,041,045201N00000001022
1      1      1      1   1      1       1   1
L056112,102106/101099/I9I#068025V0222011B0011,001/001199I0?
1      1      1      1   1      1       1   32   2
,008047/047046             BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

This works similarly, but is "simpler" because it has "clear down to
200" on the first card, and "clear from 0 to 199" on the second one. It
also has fewer "active" characters: 94 as opposed to 109 (not counting
the bootstrap, which is the same in both cases).

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022029,036040,047055,059201/I9I#054032V02920111001I0?CLEAR 200-
1      1      1      1      1      1   1      1       1   1
L070112,102105/101099        CLEAR 0 to 199               1,001/001199
1      1      1      1      1      1   1      1           32   2
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

=======================================================================

5.  Here's the shortest one I've found that uses MA (81 "important"
characters), but it sets word marks at 187 and 191 14 times (instead of
once), and executes NOP 14 times.  It needs to have the core size
punched into columns 16-18 of the second card.  It depends on the clear
storage and branch instruction not needing to have a word mark after
it.  One can get a don't-clear-storage-and-bootstrap by removing the
first two cards.


....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019026,033L047200,0340421,001/001199I0?            CLEAR CORE 1 
1      1      1   1      1      33   2   
              /I9I#199018,187191NB015200&/186099           CLEAR CORE 2 
1      1      1   1      1      11       1
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

=======================================================================

6.  This one uses SBR (so you'd need advanced programming).  It also
uses the fact that clear storage anywhere in 0-99 leaves the true core
size in the B address register, so it doesn't need to have the core
size in it.  One can get a don't-clear-storage and bootstrap by
removing the two CLEAR CORE cards.  Of the loaders I know that can be
split into clear core cards, and a bootstrap card, it has the smallest
number of "important" characters -- 79, but it sets word marks in 189
and 193 14 times (instead of once), and executes NOP 14 times.  Also
see #10.  I haven't been able to get the clear storage onto one card
(except #11 fits on one card, but then crashes).

........................................................................
THIS ONE IS ACTUALLY BROKEN.
........................................................................

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030037,200L048,0380461,001/001199           CLEAR CORE 1
1      1      1      1   1   1      32   2      2
                     /000H025,189193NV0222001/188099       CLEAR CORE 2
1      1      1      1   1   1      11       1
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019023,030031,200Lxxx1,001/001199
1      1      1      1   1   11
              /000H018,189193,188188NV0152001/188089
1      1      1   1   1      1      11       1

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,019023,200L041,0300311,001/001199
1      1      1   1   1      AA
              /000H018,189193,188188NV0152001/188089
1      1      1   1   1      1      11       1
=======================================================================

7.  Here's one that's less tricky; it also uses 79 "important" characters:

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026L0461921001/099H175B172200X1,001             CLEAR CORE 1
1      1      1      1   3   2   2       22   
L033200,176180,188189B172/001199X                          CLEAR CORE 2
1      1      1      1   3
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

               ORG  172                             0172
     CLEAR     CS   99                    4  0172  / 099
               SBR  CLEAR+3               4  0176  H 175
               BCE  CLEAR,TEST,X          8  0180  B 172 200 X
               R                          1  0188  1
               SW   1                     4  0189  , 001
               CS   1,199                 7  0193  / 001 199
               DC   @X@                   1  0200

=======================================================================

8.  This one uses a clear routine similar to #7, but it uses the same
bootstrap card before and after the clear storage card.  One can get a
don't-clear-storage-and-bootstrap by removing the CLEAR card and one of
the BOOTSTRAP cards.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1
/099H170B167200R1,001/001199 CLEAR     L034200,171175,183184,188195B167
3   2   2       22   2      2          1      1      1      1      1   1
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

Here's the source for the second card.  Autocoder would produce it as
an ordinary "load" card.

               ORG  167                             0167
     CLEAR     CS   99                    4  0167  / 099
               SBR  CLEAR+3               4  0171  H 170
               BCE  CLEAR,TEST,R          8  0175  B 167 200 R
               R                          1  0183  1
               SW   1                     4  0184  , 001
               CS   1,199                 7  0188  / 001 199
     TEST      DCW  @ CLEAR@              6  0200
               EX   CLEAR                          B 167

=======================================================================

9.  Here is one that uses the "modify add" method.  The core size needs
to be punched into columns 2-4 of the second card.  It depends on the
clear-storage-and-branch not needing a word mark after it.  It also
uses the same bootstrap card before and after.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1      1                        1      1      1      1      1   1
/I9I#200166B163200X/0991,001/001199I0?XL039200,166173,181185,186190B162
3   2      2       2   22   2          1      1      1      1      1   1
,008047/047046               BOOTSTRAP L038038,054061,068072,0010401040
1      1                               1      1      1      1      1   1

     * CLEAR CORE ROUTINE
               ORG  162
     CLEAR     CS   15999                 4  0162  / I9I
               MA   M100,CLEAR&3          7  0166  # 199 166
               BCE  CLEAR,M100,X          8  0173  B 163 200 X
               CS   99                    4  0181  / 099
               R                          1  0185  1
               SW   1                     4  0186  , 001
               CS   1,199                 7  0190  / 001 199
     M100      DSA  15900                 3  0199  I0?
               DC   @X@                   1  0200
               EX   CLEAR                          B 162

=======================================================================

10.  Here's one that fits in two cards.  It uses SBR, the fact that
clear storage anywhere in 0-99 leaves the true core size in the B
address register, and that clear storage and branch doesn't need a word
mark in the next character.  The clear storage and bootstrap are
conflated.  One can't make a don't-clear-storage-and-bootstrap from it.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026L0631881001/099H154B15120521,001040,047054,061068  INIT 1
1      1      1      1   3   2   2       22      2      2
,033040,047055L071205,051,155159,167168,175182,193B151,072/040199INIT 2
1      1      1      1   1      1      1      1   1   3   2

Here's the clear storage and bootstrap, ORG 151, without its own
bootstrapping and loading code.  All but the last two instructions are
on the first card; the last two are on the second card.

..150..155..160..165..170..175..180..185..190..195..200..205
     /099H154B15120021,001040,047054,061068,072/001199INIT 2
     3   2   2       22      2      2      2   3

     * CLEAR CORE AND BOOTSTRAP ROUTINE
               ORG  151                                      0151
     CLEAR     CS   99       WRAPS AROUND          4  0151  / 099
               SBR  CLEAR+3                        4  0155  H 154
               BCE  CLEAR,TEST,2  DONE?            8  0159  B 151 205 2
               R             YES, BOOTSTRAP        1  0167  1
               SW   1,40                           7  0168  , 001 040
               SW   47,54                          7  0175  , 047 054
               SW   61,68                          7  0182  , 061 068
               SW   72                             4  0189  , 072
               CS   40,199   CLEAR THIS ROUTINE    7  0193  / 040 199
     TEST      DC   @INIT 2@                       6  0205

=======================================================================
11.  Here are more two-card loaders.  They don't load a clear routine
outside the read area; rather, they execute entirely in the read area.
They use SBR, the fact that clear storage anywhere in 0-99 leaves the
true core size in the B address register, that clear storage and branch
doesn't need a word mark in the next character, that long instructions
are OK, and that BCE takes its D modifier from the last character, even
if it's longer than eight characters.  The load instruction at 30-39 on
the first card serves two purposes, and has a side effect:  It clears
80-99, it sets a sentinel to indicate clearing isn't done, and it leaves
a word mark in 80.  The word mark in 80 is cleared by the END card.  To
clear it here, replace the ,072072 at 54-60 on the first card with
L009080.  Even though the clear routine is on the second card, the second
card on its own is a bootstrap.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030040/020,001L021100   ,047054,061068,072072B068   1022
1      1      1      1   1   1         1      1      1      1      1   1
,008047/047046       /000H025B022100  0/061039,054061,068072,0010401040
1      1      1      1   1   1         1      1      1      1      1   1

This one doesn't depend on clear storage and branch not needing a word
mark.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030040/020,001L021100   ,047054,061068,072072B068   1022
1      1      1      1   1   1         1      1      1      1      1   1
,008015,022047/047046/000H025B022100  0/061046,054061,068072,0010401040
1      1      1      1   1   1         1      1      1      1      1   1

This one doesn't depend on 10-character BCE
....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030040/020,001L020100   ,047054,061068L019090,0380381022
1      1      1      1   1   1         1      1      1      1      1   1
,008015,022047/047046/000H025B0221000N0/061046,054061,068072,0010401040
1      1      1      1   1   1       1 1      1      1      1      1   1

This one uses SBR, the fact that clear storage anywhere in 0-99 leaves
the true core size in the B address register, that clear storage and
branch doesn't need a word mark in the next character, and that
7-character BCE works and takes its D modifier from the seventh
character.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030040/019,001,037072N00,047054,061068L020104L0190901022
1      1      1      1   1   1      1  1      1      1      1      1   1
,008047/047046       /000H025B022104N00/061046,054061,068072,0010401040
1      1      1      1   1   1      1  1      1      1      1      1   1

This one doesn't depend on clear storage and branch not needing a word
mark.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022026,030040/019,001,037072N00,047054,061068L020104L0190901022
1      1      1      1   1   1      1  1      1      1      1      1   1
,008015,022047/047046/000H025B022104N00/061046,054061,068072,0010401040
1      1      1      1   1   1      1  1      1      1      1      1   1

Yet another one in the same style.  It depends on 7-character BCE and
that clear storage and branch leaves x00-1, not the NSI address, in the
B register.  Notice that the word mark in 83 (the one set by the load
instruction that clears 83-99) is cleared, and the word mark in 72 is
set, by the load instruction that clears 72-90.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022029,033040/029019,047,001054L020104L019090,061068N0000001022
1      1      1      1      1   1      1      1      1      1      1   2
,008015,022047/047039/029000H028B022104/061039,054061,068072,0010401040
1      1      1      1      1   1      1      1      1      1      1   1

=======================================================================
12.  Here's another two-card loader, similar in spirit #11, but using MA.
It depends on 7-character BCE using the 7th character for its D modifier.
Put the memory size in cc 23-25 of the second card.

,008015,022026,033040,047/033019,001054,061068L020104L019090B068   1022
1      1      1      1   1      1      1      1      1      1      1   2
,008047/047046    I0?/I9I#021025B022104/061039,054061,068072,0010401040
1      1             1   1      1      1      1      1      1      1   1

=======================================================================
13.  Here's another two-card loader, not quite as tricky as #11.  It uses
SBR and the fact that clear storage anywhere in 0-99 leaves the true core
size in the B address register, but nothing "tricky,"  unless you count
that the LCA that clears 81-99 also sets the last instruction's word mark.
All of the clear is on the first card, and the second one is a bootstrap
on its own, but there's no room on the first card for a sequence number or
ID.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022029,036043,047051,059063,070100/042H046V0431001/062,001077L0190991001
1      1      1      1      1      1      1   1   1       1   1      1      1   L
,008015,022029,036040)063070/040039    ,001047,054061,068072)0770811040
1      1      1      1      1      1   1      1      1      1      1   1

=======================================================================
14.  Here are two-card loaders for a 1400-character machine.  The first
card of the first one doesn't have room for ID and sequence number.  The
first one doesn't clear 81-99.  The second card can work for 2k and 4k
machines by putting the memory size in 14-16 on the second card. "x" in
word-mark descriptions represents a word mark cleared by the second
card. "2" represents a word mark set by the second card.  The clear and
bootstrap can't be separated.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80
,008015,022023,031032,,041044,,,060066,,,,,,051067/T99////////////,0740781001
1      1      1      11      111      111111      1   1111111111111      1   1
,047054,061068)051067N)074078NN)060066)))))N00/054044,061072,0010401040
2      x      x      xx      xxx      xx2xxx  2   x  2xxxxxx2xxxxxx2   2 x   x

....5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80
,008015,022029,036040,047054,061068/039,001032L028099,013017,0210281001
1      1      1      1      1      1   1      1      1      1      1   1
,008012,101N/T99,014A049016)014V0131011/061039I0            ,0010011040
1      x   xx   x   x      x   x       1      1      1      1      1   1

=======================================================================
15.  Here's a two-card loader for an entirely different load format.  The
loads and the set/clear word marks are separated (so patching is difficult),
but there's a good chance more of the card gets used, so decks would be
shorter.  It uses SBR, the fact that clear storage anywhere in 0-99 leaves
the true core size in the B address register, that long instructions are OK,
and that BWZ takes its D modifier from the last character, even if it's
longer than eight characters.  The clear card has 1029 its sequence field.
If you drop the deck, sort it, and find the one with 1029 in its sequence
field and 5 in column 68.  Every other card will have 1 or B in column 68.

....5...10...15...20...25...30...35...40...45...50...55...60...65...70.
,008015,022029,036043,047051,061065,072100/028H046V043100  1,001L0250991029
1      1      1      1      1      1      1   1   1         1   1      1   1
,008015,022029,036043,061068)065076/061060                  ,0010721061
1      1      1      1      1      1      1                 1      1   1

<--- stuff to be loaded  ---------------------------------->Lxxxyyy1061
1                                                           1      1   1
<--- stuff to be loaded on last load card ----------------->Lxxxyyy1001
1                                                           1      1   1
,008015,022029,036043,050057,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxx,xxxxxx1001
1      1      1      1      1      1      1      1      1   1      1   1
SW's can be CW's

Last SW/CW card before EX:
,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxx,xxxxxxBeee
1      1      1      1      1      1      1      1      1   1      1   1
The branch might appear before column 68 -- remember, branch with blank D
is unconditional.

Last SW/CW card before END:
,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxxxxx,xxx/eee080    
1      1      1      1      1      1      1      1      1   1      1   1
CS and branch might appear before column 61.

=======================================================================

16.  Here are the shortest ones I know.  They clear all of core and then
crash (because they erase themselves).

....5...10...15...20...25.
,008015,019001H025/015
1      1      1   1

,008015,019023/099H018B015
1      1      1   1   1

,008015,019025/I9ILI0?I8I
1      1      1   1      1
