Search Table (STB)/OP=66

Format

OP AF BF A Syllable B Syllable C Syllable

OP = 66

AF Unused and reserved. AF can be specified as an indirect field length but a literal flag causes an invalid instruction fault (IEX=21).
BF Search variant can be specified as an indirect field length. The following variants can be specified by this field after any Indirect Field Length has resolved:

Comparison BF
Search lowest 09
Search highest 08
No bit equal 07
Any bit equal 06
A greater than or equal to B 05
A greater than B 04
A less than or equal to B 03
A less than B 02
A not equal to B 01
A equal to B 00

The use of all other BF values is reserved and an invalid instruction fault (IEX=26) occurs.

A is the address of the key field and can be indexed, indirect, or extended. The final address controller specifies the data type for both the key (A) and the comparison. The address controller must specify UN or UA. An SN controller causes an invalid instruction fault (IEX=03).
B is the address of the base of the table and can be indexed, indirect, or extended. The final address controller must be UN or an invalid instruction fault (IEX=03) occurs.
C is the address of the table descriptor and can be indexed, indirect, or extended. The final address controller must be UN or an invalid instruction fault (IEX=03) occurs. The length of this field is always 24 digits and in the following format:

Information Digits
Table Entry Length (digits) 00-05
Comparison Offset (digits) 06-11
Key Length (digits) 12-17
Table Limit (address) 18-23
Note: The lowest memory address is 00.

Invalid table descriptor values cause an invalid instruction fault (IEX=07).

A table entry length or key length of zero causes an invalid instruction fault (IEX=07).

Function

STB is a general search instruction for tables. The data contained in the key (A) is compared with the data located in a specified table field. Except for search lowest or search highest, if the comparison condition specified by the least significant digit of BF is met, the address of the table entry is stored in IX1 and the comparison flags are set. If the selected condition is not met, the next table entry is examined. This procedure continues until the next table entry address is equal to or exceeds the table limit address.

In the case of search lowest or search highest, the entire table is examined before the address of the entry with the lowest or highest value is stored in IX1.

Add the value of the comparison offset (C 06:6) to the table base address (B) to find the first field to be compared.

If the address of the first field to be compared is equal or greater than the table limit, the table is empty. The value CiEEEEEE, where i represents the base indicant of the resolved B-address, is stored in IX1 and the comparison flags set to NULL.

If the comparison condition is not met, the sum of the table base address (B) and the table entry length (C 00:6) replaces the table base address to point at the next table entry. If the next table entry address is equal to or exceeds the table limit address (C 18:6), the comparison flags set to HIGH and the instruction terminates. Otherwise, another comparison is executed using data from the new table entry.

Except in the case of search lowest or search highest, if the table limit is reached or exceeded, the comparison flags set to HIGH and the instruction terminates as indicated above, with IX1 containing CiEEEEEE. The relative address stored in IX1 contains the base indicant associated with the resolved B-address.

The table must reside within a memory area specified by the base indicant associated with the resolved B-address. The processor does not check for improper memory assignments.

Any Bit Equal

Any Bit Equal requires that the key (A) field be logically added to the comparison field, by using the AND instruction, to determine if the the result is zero. If the result is not equal to zero, a match occurred.

No Bit Equal

No bit equal requires that the key (A) field be logically added to the comparison field, by using the AND instruction, to determine if the result is equal to zero. If the result is equal to zero, a match occurred.

Search Highest

Search highest terminates only when the table limit is exceeded. If any comparison field entries are found that are greater than the key (A), store the table entry pointer, relative to the same base as the resolved B-address, for the first field that is greater than or equal to all those fields that are greater than the key, in IX1 with the same base indicant as the resolved B-address.

If no entries are greater than the key (A), the NULL list value, CiEEEEEE, is stored in IX1.

Search Lowest

Search lowest terminates only when the table limit is exceeded. If any comparison field entries are found that are less than the key (A), the table entry pointer relative to the same base as the resolved B-address for the first field that is less than or equal to all those fields that are less than the key, is stored in IX1 with the same base indicant as the resolved B-address.

If no entries are found that are less than the key (A), the NULL list value, CiEEEEEE, is stored in IX1.

Comparison Flags

If the comparison condition is met on the first compare, the comparison flags set to LOW.

If the comparison condition is met on other than the first compare, the comparison flags set to EQUAL.

If the comparison condition is not met, the comparison flags set to HIGH.

If the table is empty, the comparison flags set to NULL.

Overflow Flag

The Overflow Flag is unchanged by this instruction.

instructions/stb.txt · Last modified: 2011/07/21 10:55 by scott
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki