INTEGER
The INTEGER instruction defines an unsigned, integer numeric variable of 1, 2, 3, 4 or 8 bytes. Integers are extremely useful for high-speed loop or arithmetic processing. It uses one of the following formats:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Data Definition Label.
%
Optional. Denotes the item as being GLOBAL.
%%
Optional. Denotes the item as GLOBAL but does not initialize it in any way.
*
Optional. Denotes the item or file as being COMMON.
size
Required. A decimal constant or EQUATEd value of 1, 2, 3, 4 or 8 (9.0) indicating the integer size.
value
Required. A numeric Literal (i.e., "345").
arraysize
Optional. An integer decimal constant, CONST variable or EQUATEd value indicating the number of array items.
target
Optional. A previously declared INTEGER variable that initializes the array.
^
Optional. Denotes the item as being a POINTER.
variable
Required. The name of a previously defined variable of the same type.
Flags Affected: NONE
Note the following:
All INTEGERS are unsigned (positive values only). If an initial value ({value}) is not specified, the variable is set to zero.
INTEGERS are stored internally in the byte order format of the system in use (LSB/MSB reverse order (Intel based systems), MSB/LSB forward order (AT&T, Western Electric, Hewlett-Packard, Motorola based systems). The interpreter handles the transfer to and from DIMs/FORMs to insure consistent results. (Note: INTEGERs may be moved to a DIM or FORM before the data is written to disk to provide transportability.)
Any operation in which the result is larger than the destination discards the high order (most significant) bytes exceeding the destination variable's size.
To insure no loss of significant data in any operations mixing FORMS and INTEGERS:
1 byte INTEGERS require 3 byte FORMs (0x0 to 0xFF - 0 to 255)
2 byte INTEGERS require 5 byte FORMs (0x0 to 0xFFFF - 0 to 65,535)
3 byte INTEGERS require 8 byte FORMS (0x0 to 0xFFFFFF - 0 to 16,777,215)
4 byte INTEGERS require 10 byte FORMs (0x0 to 0xFFFFFFFF - 0 to 4,294,967,295)
8 byte INTEGERS require 20 byte FORMs (0x0 to 0xFFFFFFFFFFFFFFFF - 0 to 18,446,744,073,709,551,615)
If format (2), (4) or (6) is used, {value} must be a valid decimal string within quotes ("").
An INTEGER may be used any place a FORM is valid except for KEYIN, DISPLAY, and PRINT. (PLBCMP also supports INTEGERS in AND, NOT, OR, TEST, and XOR.)
The ^ denotes a Pointer Variable.
If the % form is used, the data item is placed in the Global Data Area. The variable is then available to other programs that also declared it with the percent form. Global Data Items are available with PLBCMP only.
If the %% form is used, the data label is placed in the Global Data Area but no initialization takes place if it has not already been defined in the Global Data Area. If an array data label is placed in the Global Data Area, when initialized, it must have the same number of elements in the array. Global Data Items are available with PLBCMP only.
If the * form is used, the data item is in common with other programs and all of the rules of COMMON must be followed.
If an array is defined, each element may have a label.
Formats (11) through (16) are only valid when the SWDBC mode of the compiler is enabled (-zc=3).
Format
(11) provides a new array initialization syntax. The {dvalue} in this syntax form is a decimal immediate
value without double quote characters.
Format
(12) provides a new INTEGER syntax for an array of FORM
pointers.
Format
(13) provides a new INTEGER array pointer construct. The INTEGER
array pointer can contain an address of a INTEGER array.
Format
(14) provides a two-dimensioned INTEGER array pointer construct. The
two-dimensioned INTEGER array pointer can contain an address of a two-dimensioned
INTEGER array.
Format
(15) provides a three-dimensioned INTEGER array pointer construct. The
three-dimensioned INTEGER array pointer can contain an address of a three-dimensioned
INTEGER array.
Format
(16) allows specification of an INTEGER where the {value}
is a numeric literal without a size specification. In this case, the INTEGER
size defaults to an four byte integer.
See Also: Example Code, FORM, Numeric Strings, Data Definitions
![]() |