Table of Contents

Compare String (CPS)/OP=A1

Format

OP AF BF A Syllable B Syllable

OP = A1

AF A memory area variant can be indirect, but a literal flag causes an invalid instruction fault (IEX=21). The most significant digit is the memory area variant. A value of 0 indicates that the memory area specified by the environment number and the memory area number contained in the first string descriptor (A) is to be used for the addresses contained within the first string descriptor. A value of 4 indicates that the memory area specified for the first string descriptor (A) is to be used for the addresses contained within the first string descriptor. The use of all other AF values is reserved and cause an invalid instruction fault (IEX=25).
BF B memory area variant. BF can be indirect. The most significant digit is the memory area variant. A value of 0 indicates that the memory area specified by the environment number and the memory area number contained in the second string descriptor (B) is to be used for the addresses contained within the second string descriptor. A value of 4 indicates that the memory area specified for the second string descriptor (B) is to be used for the addresses contained within the second string descriptor. The use of all other BF values is reserved and cause an invalid instruction fault (IEX=26).

The A Syllable is the Address of the first string descriptor. It can be indexed, indirect, or extended. The final address controller must specify UN or an invalid instruction fault (IEX=03) occurs.
The B Syllable is the Address of the second string descriptor can be indexed, indirect, or extended. The final address controller specifies the padding variant as follows:

Padding Variant B-Controller
Pad With Zero 0 (UN)
No Padding 1 (SN)
Pad with Blank (40) 2 (UA)

Function

CPS compares the binary values of the substring defined by the string begin and end addresses. The addresses are specified by the A-string descriptor of the substring defined by the string begin and end addresses specified by the B-string descriptor.

The Comparison Flags are set to EQUAL if the strings are identical, to HIGH if the A-string is of greater value than the B-string, and to LOW if the A-string is of lesser value than the B-string. No comparison takes place on the data located at the string end address.

If a string begin address is greater than the string end address, an address error fault (AEX=01) occurs and the instruction terminates.

The comparison of two null strings (strings of zero length) causes the comparison flags to be set to EQUAL.

If the source and destination lengths are equal, the strings are compared and the comparison flags are set.

If the lengths are unequal, the comparison is dependent on the value of the B-address controller.

If the B-address controller is 1, the longer string is compared to the shorter string for the length of the shorter string only. However, for this case of no padding, comparison with a null string always sets the comparison flags to EQUAL.

If the B-address controller is 0, the longer string is compared to the shorter string for the length of the shorter string. Then the remainder of the longer string is compared against zeros. (For comparison with a null string, a non-null string is compared entirely against zeroes.)

If the B-address controller is 2, the longer string is compared to the shorter string for the length of the shorter string. Then the remainder of the longer string is compared against blank (40) characters. (For comparison with a null string, a non-null string is compared entirely against blank characters.)

Comparison Flags

Set the Comparison Flags to HIGH if the A-string is of greater value than the B-String.

Set the Comparison Flags to EQUAL if the A-string is equal to the B-string.

Set the Comparison Flags to LOW if the A-string is of lesser value than the B-String.

Overlap

Partial overlapping descriptors produce unspecified results that can vary from processor model to processor model.