Call Box Commands
Version 2.0 15 Jan-90

CALL AY the SUPER ARRAY commands

Due to the limited Applesoft program code area (about 31K) it is advantageous to put as much of the programs support data as possible out of this area (bank 0). Super Arrays allow you to put all of your Arrayed data up in the upper banks of your computers memory, this frees up a lot of room down in bank 0 and allows for bigger program code. These arrays also provide the capability of much larger arrays than was possible before... their size is directly dependent on how much memory your IIgs has available.

There are 5 commands that control arrays.

CALL AY,0,N UNDIMENSION ARRAY: Remove an array from the array table.
CALL AY,1 ,N,{0,1 ,...,81} DIMENSION ARRAY: Reserve memory for an array (N{0,1,...787}).
CALL AY,2,N,{0,1 ,...,87},V GET VALUE: gets a value (V) from array (N{0,1,...,87}).
CALL AY,3,N,{0,1 ,...,87},V SET VALUE: sets a value (V) in array (N{0,1,...,87}).
CALL AV,4,N,V SET ALL VALUES: sets all entries in array (N) to value (V).

The name of an array. Should be a valid Applesoft type variable (real, integer, or string). Once a type is set, all subsequent calls to that array should use the same type and same name for the array.

Array subscripts. Use to define the size of the array or to get/set a value. Each number represents a particular element within the array. You must specify at least one element. Subscripts can be any valid numeric type (including decimal, binary, and hexadecimal) and are limited in size to 64K (although your particular memory configuration may impose a greater limit). Also, you are limited to only 88 dimensions.

Array value. Should be a variable of the same type as the array. In other words, if your array is a string array then V should be a string variable.

Super Array Operation
Super Arrays follow similar conventions to Applesoft arrays. However, you have the added ability to "undimension" a super array (i.e. de-allocate the memory associated with it) and to set all values in a super array to the same value. To use a super array use should first use the dimension command. You would define a real array called "A" in the following manner:

100 CALL AY,1,A,{4,4,4,4}

The above line will dimesion a 5 by 5 by 5 by' 5 element array for a total of 625 elements. If you want to set all the values in this array toO you would use the Set All Values call with a value of zero.

110 CALL AY,4,A,0

Suppose you wanted to set the value of the (1,0,3,2) element to 15. Use the Set Value call to do this:

120 CALL AY,3,A,{1,0,3,2),15

If you wanted to examine the same element you would use the Get Value call as follows:

130 CALL AY,2,A,{1,0,3,2},V

The value of the element will be in the variable '9V." Make surethat any variable or value used to get or set a value should be of the same type as the array. Otherwise you will get a "Wrong Super Array Type" error. If you wanted to dispose of a super array to free up some memory, you would use the undimension array call.

140 CALL AY,0,A

That's all there is to it! You can have as many super arrays as you have variables for within memory constraints (in addition to any Applesoft arrays your program has dimensioned).