Download Print this page

Array Memories To Simplify Programming; Cautions When Using Array Memories; Sample Programs That Use Array Memory - Casio CFX-9800G Owner's Manual

Color power graphic
Hide thumbs Also See for CFX-9800G:

Advertisement

As you can see, array memory names consist of an alphabetic character, followed by a
subscript enclosed in brackets. The subscript is a value, either positive or negative, or
a value: memory that represents a value. If the value of 5 is assigned to value memory
X, for example, the array memory A[X] would be equivalent to A[5].
Array Memories to Simplify Programming
Since the subscript of an array memory can be a value memory name, programming be-
comes more economical. Note the following.
Example]
To write a program that assigns the values from 1 through 10 to memories
A through J
Using value memories
1,7,4,:,2,>,B 5,
5,7,E,:,6,7,F,:,
9,7,1,:,1,0, +,J
40 bytes
Using array memories
9,>,2Z,:,Lb,1232.4+,1>A62)5,
Isz, Z,:, Z, <, 1, ®, =, Goto, 1
26 byies
As you can see, using array memories uses 14 fewer bytes. You get evén more economy
with the following program.
To write''a program that displays the contents of a memory specified by
input
Using value memories
Lbl, 1,352,752, 3,
Z=,1,9,A,
4,Z
Z, =,
3,4, C; 4, Z,
Z, =,5, 5,6,
4,Z
Z, =,7,>,G,
4,Z,
Z=,9, 5,1, 4,2,
Goto, 1
70 bytes
Using array memories
Lb,13%7,
25A0Z-01)
4,
Goto, 1
A
:
* 46 bytes
With value memories, logical operations are used to test the input until the proper memory
is found. With array memories, on the other hand, the specified memory is found im-
mediately.
MCautions When Using Array Memories
You should remember that array memories are actually based on value memories. Note
the following relationship.
Array Memory
)-fT1 1
'A[23) Al24} A[25] A[26] 'A[27]
B[22] B[23} B[24] B{25] Bi26]
fat} C[22} C23] C[24] C[25)
Value memory
[TTT
ALOJAL 4] A[2] ALS]
AL 4} ALS] ALG]
B[-1]
B[ 0] Bl 1] B[2] B[3] [4] Bf 5]
1-21. C[-1] CLO} Cl 1} Cl2] Cp] cp4]
G[-6] G[-5] G[-4] Gf-3] Gf-2] GI-1] G[0)
enr7) G[18) G19] G[20] G21)
x[O] X11] X12] X[ 3] X[ 4]
YA} YO} YE1] YL2] Y13]
2-2] 2-1] 210] 2111 Z[2]
This means that you must be careful when using array memories that you do not overlap.
Sample Programs That Use Array Memory
The following programs store x and y data in array memories. Whenever an x value is
input, the corresponding y value is displayed. You can input a total of 15 sets of data. .
With this version of the program, value memory A is used as a data
control memory, while memory B is used for temporary storage of x
data. The x data is stored in memories C[1] (value memory D) through
C[15] (value memory R), while the » data.is stored in memories C[16]
(value memory S) through C[30] (value memory Z{7]).
1, >,,A,:, Defm, 7, :,
ibl,1,:,7,>,C,
LA):
2>GLA
+4, Sa
Isz, A, :
=, Goto, 2, :, Goto, 1,3,
A, ], >, Goto, 4,:,
2, Goto, 2, :
Lol, 4,:,C,[, A, +, 1,5, ],.4, "Goto, 2

Advertisement

loading