Clearing core in IBM 1401
Clearing fewer than 101 characters, down to x00
To clear fewer than 101 characters, down to x00, use CS xtu, where
tu are the tens and units digits of the top address to clear.
Clearing a few hundreds of characters, down to x00
To clear a few hundred characters, down to x00, use CS ztu, where
z is greater than x but not much greater, followed by
z-x+1 one-address clear storage instructions. These are chained onto the first one. This is frequently
used to clear the print area:
cs 332
cs
Clearing many, or an indeterminate number, of hundreds of characters,
down to x00
There are three ways to clear core down to x00 using loops.
Using compare
Assume an address constant contains w99, where w is x-1.
loop cs top
sbr loop&3
c loop&3,adcon
bu loop
...
adcon dsa w99
This requires 23 characters.
If the code needs to be reused, put the top address to be cleared into
loop&3 using
mcw &top,loop&3
or
sbr loop&3,top
This increases the requirement to 33 or 30 characters, respectively.
Using BCE
If the prior contents of a character in the bottom century to clear are
known, and known not to be blank, it can be tested to determine whether
that century has been cleared:
mcw *-6,xyz
loop cs top
sbr top&3
bce loop,xyz,M
This requires 23 characters.
If the value of xyz is known, that value can be tested at the bottom of
the loop, and the MCW is not needed. This brings the requirement down
to 16 characters.
Using BW
If it is known that a character in the bottom century to be cleared
contains a word mark, it can be tested to determine whether that century
has been cleared:
sw xyz
loop cs top
sbr top&3
bw loop,xyz
This requires 20 characters.
If it is known that xyz has a word mark, the first instruction is not
needed. This brings the requirement down to 16 characters.
Using an index register
So as not to require to change the A-address field at loop&3, one
can use an index register, say X3:
loop cs 0&x3
sbr x3
...
This requires putting the top address to clear into X3 instead of
loop&3 before starting the loop.
Clearing down to xyz
To clear down to xyz, where xyz is not x00, the easiest way is to use an
index register. Assume clearing is to start at xtu, where tu is
greater than yz.
sbr x3,xtu
sw xyz
loop mcw @ @,0&x3
sbr x3
cw 1&x3
bw loop,xyz
If X3 already contains an appropriate address, perhaps as a result of
using X3 to clear down to y00 where y equals x+1, the first instruction
can be deleted.