553
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Table Data Processing Instructions
3
Table Data Processing Instructions
z SNUM(638)
Counts the amount of stack data (number of words of data) from the stack pointer to the beginning of
the data region.
z Record-table Instructions
A series of data consisting of more than one record with the same number of words in each record is
called table data. Table data stored in the specified I/O memory are can be registered as the table area
using the DIM instruction. Up to 16 separate tables can be defined with table numbers 0 to 15.
Index Registers (IR) can be used to indirectly reference table data. Address calculation of the record
can be easily made by using the SETR(635) (SET RECORD NUMBER) instruction and GETR(636)
(GET RECORD NUMBER).
z Range Instructions
The range instructions included here act on a specified range of words to find the maximum value
(MAX(182)) or minimum value (MIN(183)), search for a particular value (SRCH(181)), calculate the sum
(SUM(184)) or FCS (FCS(180)), or swap the contents of the leftmost and rightmost bytes in the words
(SWAP(637)).
The following diagram shows the basic
structure of a record table. Each record in a
table has the same number of words.
0005
A
B
C
D
E
A
B
C
D
E
Stack
Data
region
Pointer
Pointer
(Unchanged)
Stack
Data region
Pointer to last
word in stack
Pointer
Counts data elements (N).
Pointer to last
word in stack
Pointer
Table number 0
Table number 1
Record
Record
Record
Tabl e
Same number of words
in each record
Range
specified in
instruction
MAX or
MIN
search
SRCH
search
SWAP
operation
SUM
calculation or
FCS
calculation