- 62 -
Copyright L
EXIBOOK
2002
GB
Using array-type memories
Lbl, 1, :, ?,
→
, Z, :, A, [, Z, -, 1, ],
,
Goto, 1
16 steps
The difference is readily apparent. When using the standard memories, the input value is compared one by
one with the value assigned to each memory ( e.g. A=1, B=2,
ˇ
)
With the array-type memories, the input value is immediately stored in the proper memory determined by
“[Z-1]”. Formulas (Z-1,A+10, etc.) can even be used for the subscript.
4.8.2 Cautions when using array-type memories
When using array-type memories, a subscript is appended to an alphabetic character that represents
a standard memory from A through Z.
Therefore, care must be taken to prevent overlap of memories.
The relation is as follows:
A[0] A[1] A[2] A[3]
A[4] A[5] A[6]
B[-1] B[0] B[1] B[2]
B[3] B[4]
B[5]
C[-2] C[-1] C[0] C[1]
C[2] C[3]
C[4]
G[-6] G[-5] G[-4] G[-3] G[-2] G[-1] G[-0]
A[23] A[24] A[25] A[26] A[27]
B[22] B[23] B[24] B[25] B[26]
C[21] C[22] C[23] C[24] C[25]
G[17] G[18] G[19] G[20] G[21]
X[0]
X[1] X[2] X[3]
X[4]
Y[-1] Y[0] Y[1] Y[2]
Y[3]
Z[-2] Z[-1] Z[0] Z[1]
Z[2]
The following shows a case in which array-type memories overlap with standard format memories. This
situation should always be avoided.
Example: Store the numeric values from 1 through 5 in memories A[1] through A[5] respectively.
5,
→
, C, :, Lbl, 1, :, C,
→
, A, [, C, ], :,
Dsz, C, :, Goto, 1, :,
A, [, 1, ],
, A, [, 2, ],
, A, [, 3, ],
,
A, [, 4, ],
, A, [, 5, ]
44 steps
In this program, the values 1 through 5 are stored in the array-type memories A[1] through A[5],
and memory C is used as a counter memory.. when this program is executed, the following results are
obtained:
0.
1.
Prog
EXE
0
EXE
3.
EXE
4.
EXE
5.
EXE