Indexing
and
Indirect Addressing
The
copy
routine,
described previously, is acceptable
if
a
limited.
number
of
words are to
be
copied.
For
example, 1,000 copy instructions are needed to copy
1,000 words.
This
wastes storage space. However,
the
copy address
could
be altered by
the
program
each
time
it
is
used.
A
program
to copy 1,000 words from tape
number
I
and
place
them
into
consecutive storage locations
could be as
in
Figure 31.
In
this program,
thirteen
instructions
and
three constants are
required
tomodify
the address
of
the
copy instruction
and
test for
the
end
of
the
copy loop.
The
program
is considerably
improved over the
routine
in
which 1,000 copy in-
structions are needed. However,
the
use
of
an
index
register makes
the
program
much
more
efficient.
The
computers
contain
three
index
registers
that
are
important
to
the
system's
operational
abilities.
These
registers are
termed
A, B,
and
C
or
1,2,
and
4.
The
latter
terminology is more convenient for
the
programmer
because
the
numbers used are
the
octal
representation
of
the
"addresses"
of
the
three
index
registers.
Inst
.
Loc. Instruction
Remarks
50
Read
tape 1
Get
tape I ready
to
read
51
Copy
200
Put
the lst
word
into location
200
52 CLA62 Clear the accumulator
to
zeros and add
10
it the
contents
of
location
62
(0000----000)
53
ADD
64
Add
to
the accumulator contents the contents of lo-
cation 64 (0000----001).
These
instructions
make a counter which
is
increased
by
one
for
each
copy instruction
executed.
54
STO
62
Store the result
in
location
62.
55 CLA63 Clear and add into the accumulator, the contents
of
location
63
(0000----1000).
56
SUB
62
Subtract
from
the accumulator (1000) the contents
of location 62.
(This
is
the location that will in-
crease
with
each copy instruction
execution.)
57
TRZ
65
Transfer when the accumulator contents are
zero.
This
will occur
when
1000
copies have been
ex-
ecuted.
58 CLA51 Clear the accumulator and add the contents of lo-
cation
51
(copy 200).
59
ADD
64
Add
the contents
of
location 64
to
the contents of
the accumulator.
This
will increase the copy
address
from
200 to
201
the first time.
The
ad-
dress will then be increased
by
one each time the
instruction
is
executed.
60
STO
51
Store the result back
at
location
51
•
61
TR
51
Transfer back
to
location
51
so
that the next
word
will
wi
II
be read in.
(Remember
that the copy address
has
been increased
by
one.)
62 00---0000 Constants:
63 00---1000
64 00---0001
65
STOP
The
program will reach this instruction after
1000
words
have been copied and will stop.
Figure 31. Sample
Program
18
IBM
709-7090
operation
tag-bits
address
1-1
___
.....
1-=0_0"--'1
.....
1
__
,---_1
register
specification
octal
alphabetic
A
10 1 0 I
11
0 0 I
S,2
11
18
2021
35
Figure 32. Index-Register
Tag
Bits
2
4
B
c
The
addresses
of
index
registers are
stipulated
in
a
part
of
the
instruction
word
known as
the
tag field.
Such addresses are normally referred to as tags.
The
tags
perform
the
same function as
the
address
~f
the
instruction.
They
tell
the
computer
whether
an
mdex
register is to
be
used
and
which register is to
be
used.
The
tag field is located
in
positions 18,
19,
and
20
of
the
instruction
(Figure 32) . By
having
more
than
one
tag
bit
in
the
tag
field, two
or
more
index
registers
may be used
in
a single instruction.
Thus,
the
con-
tents
of
the registers would be combined
and
the
re-
sultant
sum
would
be
used.
The
index
registers are
15
positions
long-large
enough to
hold
the
largest possible storage address.
They
are used to modify
an
address by
adding
the
complement
of
their
contents to the address.
This
re-
duces
the
address by
the
contents
of
the
index
regis-
ter.
Many
instructions may specify
index
action, thus
making
them
useful for such functions as address
modification
and
counting.
As
an
example
of
the
arithmetic involved
when
in-
dex registers
are
used, assume
that
index
register I
contains
the
number
2
and
that
the
copy instruction,
with
an
address
of
200,
is
to be executed.
The
follow-
ing
occurs (Figure 33) .
When
the
copy
instruction
is decoded,
the
tag
bit
in
position
20
specifies
index
action; thus,
the
contents
of
index
register 1 are complemented
and
placed
in
the adders.
Note
that
the
contents
of
an
index
reg-
ister are always complemented when sent to
the
ad-
ders.
This
feature results
in
subtracting
the
contents
from
the
address.
The
address
portion
of
the
copy in·
struction is also placed
in
the
adders;
after
adding
the
two numbers,
the
result (called
the
effective address)
is
used
in
execution
of
the
copy instruction
instead
of
operation
tag
address
1000111000000100000010011000000010000000 I
address
part
of
instruction·-·0000000100oo000
index register contents - - -111111111111101
_111111111111101
carry
is
added into ( 000000001111101
units postion - - - - )0 1
Effective address -- - - 000000001111110 =
176
Figure
33.
Index-Register Arithmetic, Subtracting