Variables

The Basic workspace execution memory is automatically partitioned by the interpreter according to the number of program lines entered by the user and the variable storage space required. If more than 54K RAM is required then data must be stored as files which use filespace in other pages of RAM. For further details see File Structure And Memory Organisation. However arrays of numerals or strings may be dimensioned as normal, the filing operation being totally transparent to the user.

Line Numbers

Line Numbers are in the range 0 to 65535. Each line can be up to 254 characters long, including the line number. Extra lines can be inserted in the text by simply typing in a new line number between the two lines of interest. In view of this, it is recommended that line numbers are separated by an increment of 10 for each new line. Line numbers are stored in binary form and occupy a constant space in memory regardless of the number chosen. Each line number requires 2 bytes of memory.

Variable Storage

HUNTER variables can be stored as either single or double precision floating point numbers. All simple variables are single precision giving 6 digit accuracy. Variables are designated by one alphabetic character (A-Z) followed by an optional alphanumeric character (A-Z) (0-9), giving up to 962 separate variables.

Note

Simple variable names ON, TO, IF, LN, AS, OR and PI should be avoided as these are also reserved words. Use as variables can lead to execution errors.

Numerical Arrays

Additionally, variables may form a one-dimension array using “DIM”. Variable arrays may optionally be designated double precision giving 14 digit accuracy but with an additional memory overhead. Single precision arrays are designated by a number in parentheses following the variable name.

e.g. A1(19),Z(2),C(X),A(20*T),AD(10),AZ(62)

There can be 962 separately identified arrays of single precision.

Note

The number in parentheses can be an expression. Each variable occupies 5 bytes of HUNTER’S user memory in arrays 7 bytes otherwise.

Double Precision

Double Precision arrays are identified by the symbol ‘!’ followed by a number or expression in parentheses. Double precision variables have 14 digit accuracy.

e.g. A1!(19),Z!(Z),C!(X),AA!(23)

These are a further 962 arrays.

Each double precision element occupies 9 bytes of HUNTER memory.

Default Values

All numeric arrays default to 11 elements unless dimensioned with DIM statement.

String Storage

Single element string arrays are automatically assigned without a DIM statement. The default length is 20 characters.

String names are defined exactly as variable names, with one alphabetic character (A-Z) and one optional alphanumeric character (A-Z, 0-9) followed by the ‘$’ symbol giving a total of 962 separately identified string variables.

HUNTER supports strings of 8 bit characters including the full ASCII character set.

The maximum length of any string is 254 characters, with a default size of 20 characters.

DIM A1$(10,15)

defines a string array of 11 elements, each of which can be up to 15 characters long.

The maximum size of an array depends on the memory available.

Examples of String variables are:

A1$,Z$,C5$(22),H$(J),MM$(32)

String variables can be initialised using LET, just assigned using =(equate), or READing from DATA statements.

The first element of a string array may be referenced with just the variable name, without the need for any number in parentheses.

Example:

A1$,Z$ Actually refer to the variables A1$(0),Z$(0)

A single variable may therefore be defined as:

ST$(0,10) and used as:
ST$

Multiple Statements

HUNTER Basic supports multiple statements in a single program line. Statements are separated by a colon (:).

Example:

100 A=0:B=10: PRINT A,B:B=11

The primary use of this feature is to reduce the program size. It may also make a program more legible. If a colon is used at the end of a line, END is assumed and program execution stops.

The following statements cannot form part of a multiple statement:

If REM is used in a multiple statement, it must be the last statement in the line.