Updated: 11 December 1998 |
VAX MACRO and Instruction Set Reference Manual
Previous | Contents | Index |
A character string is specified by the following two operands:
Each of the character string instructions uses general registers R0 to R1, R0 to R3, or R0 to R5 to contain a control block that maintains updated addresses and state during the execution of the instruction. At completion, these registers are available to software to use as string specification operands for a subsequent instruction on a contiguous character string. During the execution of the instructions, pending interrupt conditions are tested. If any conditions are found, the control block is updated, a first-part-done bit is set in the processor status longword (PSL), and the instruction is interrupted (refer to Appendix E). After the interruption, the instruction resumes transparently. The format of the control block is as follows:
The fields LENGTH 1, LENGTH 2 (if required), and LENGTH 3 (if required) contain the number of bytes remaining to be processed in the first, second, and third string operands, respectively. The fields ADDRESS 1, ADDRESS 2 (if required), and ADDRESS 3 (if required) contain the address of the next byte to be processed in the first, second, and third string operands, respectively.
Memory access faults do not occur when a zero-length string is specified because no memory reference occurs.
The following instructions are described in this section.
Description and Opcode | Number of Instructions | |
---|---|---|
1. |
Compare Characters 3 Operand
CMPC3 len.rw, src1addr.ab, src2addr.ab, {R0-3.wl} |
1 |
2. |
Compare Characters 5 Operand
CMPC5 src1len.rw, src1addr.ab, fill.rb, src2len.rw, src2addr.ab, {R0-3.wl} |
1 |
3. |
Locate Character
LOCC char.rb, len.rw, addr.ab, {R0-1.wl} |
1 |
4. |
Match Characters
MATCHC len1.rw, addr1.ab, len2.rw, addr2.ab, {R0-3.wl} |
1 |
5. |
Move Character 3 Operand
MOVC3 len.rw, srcaddr.ab, dstaddr.ab, {R0-5.wl} |
1 |
6. |
Move Character 5 Operand
MOVC5 srclen.rw, srcaddr.ab, fill.rb, dstlen.rw, dstaddr.ab, {R0-5.wl} |
1 |
7. |
Move Translated Characters
MOVTC srclen.rw, srcaddr.ab, fill.rb, tbladdr.ab, dstlen.rw, dstaddr.ab, {R0-5.wl} |
1 |
8. |
Move Translated Until Character
MOVTUC srclen.rw, srcaddr.ab, esc.rb, tbladdr.ab, dstlen.rw, dstaddr.ab, {R0-5.wl} |
1 |
9. |
Scan Characters
SCANC len.rw, addr.ab, tbladdr.ab, mask.rb, {R0-3.wl} |
1 |
10. |
Skip Character
SKPC char.rb, len.rw, addr.ab, {R0-1.wl} |
1 |
11. |
Span Characters
SPANC len.rw, addr.ab, tbladdr.ab, mask.rb, {R0-3.wl} |
1 |
Compare Characters
3operand: opcode len.rw, src1addr.ab,
src2addr.ab5operand: opcode src1len.rw, src1addr.ab, fill.rb,
src2len.rw, src2addr.ab
N|| <--- {first byte} LSS {second byte}; | |
Z|| <--- {first byte} EQL {second byte}; | |
V|| <--- 0; | |
C|| <--- {first byte} LSSU {second byte}; |
29 | CMPC3 | Compare Characters 3 Operand |
2D | CMPC5 | Compare Characters 5 Operand |
In 3 operand format, the bytes of string1 specified by the length and address1 operands are compared with the bytes of string2 specified by the length and address2 operands. Comparison proceeds until inequality is detected or all the bytes of the strings have been examined. Condition codes are affected by the result of the last byte comparison. In 5 operand format, the bytes of the string1 operand specified by the length1 and address1 operands are compared with the bytes of the string2 operand specified by the length2 and address2 operands. If one string is longer than the other, the shorter string is conceptually extended to the length of the longer by appending (at higher addresses) bytes equal to the fill operand. Comparison proceeds until inequality is detected or all the bytes of the strings have been examined. Condition codes are affected by the result of the last byte comparison. For either CMPC3 or CMPC5, two zero-length strings compare equal (that is, Z is set and N, V, and C are cleared).
Notes
R0 = | Number of bytes remaining in string1 (including byte that terminated comparison); R0 is zero only if strings are equal |
R1 = | Address of the byte in string1 that terminated comparison; if strings are equal, address of 1 byte beyond string1 |
R2 = | R0 |
R3 = | Address of the byte in string2 that terminated comparison; if strings are equal, address of 1 byte beyond string2 |
R0 = | Number of bytes remaining in string1 (including byte that terminated comparison); R0 is zero only if string1 and string2 are of equal length and equal or string1 was exhausted before comparison terminated |
R1 = | Address of the byte in string1 that terminated comparison; if comparison did not terminate before string1 exhausted, address of 1 byte beyond string1 |
R2 = | Number of bytes remaining in string2 (including byte that terminated comparison); R2 is zero only if string2 and string1 are of equal length or string2 was exhausted before comparison terminated |
R3 = | Address of the byte in string2 that terminated comparison; if comparison did not terminate before string2 was exhausted, address of 1 byte beyond string2 |
Locate Character
opcode char.rb, len.rw, addr.ab
N|| <--- 0; | |
Z|| <--- R0 EQL 0; | |
V|| <--- 0; | |
C|| <--- 0; |
3A | LOCC | Locate Character |
The character operand is compared with the bytes of the string specified by the length and address operands. Comparison continues until equality is detected or all bytes of the string have been compared. If equality is detected, the condition code Z-bit is cleared; otherwise, the Z-bit is set.
Notes
R0 = | Number of bytes remaining in the string (including located one) if byte located; otherwise, zero |
R1 = | Address of the byte located if byte located; otherwise, address of 1 byte beyond the string |
Match Characters
opcode objlen.rw, objaddr.ab, srclen.rw, srcaddr.ab
N|| <--- 0; | |
Z|| <--- R0 EQL 0; !match found | |
V|| <--- 0; | |
C|| <--- 0; |
39 | MATCHC | Match Characters |
The source string specified by the source length and source address operands is searched for a substring that matches the object string specified by the object length and object address operands. If the substring is found, the condition code Z-bit is set; otherwise, it is cleared.
Notes
R0 = | If a match occurred, zero; otherwise, the number of bytes in the object string |
R1 = | If a match occurred, the address of 1 byte beyond the object string; that is, objaddr + objlen; otherwise, the address of the object string |
R2 = | If a match occurred, the number of bytes remaining in the source string; otherwise, zero |
R3 = | If a match occurred, the address of 1 byte beyond the last byte matched; otherwise, the address of 1 byte beyond the source string; that is, srcaddr + srclen |
Move Character
3operand: opcode len.rw, srcaddr.ab, dstaddr.ab
5operand: opcode srclen.rw, srcaddr.ab, fill.rb,
dstlen.rw, dstaddr.ab
N|| <--- 0; !MOVC3 | |
Z|| <--- 1; | |
V|| <--- 0; | |
C|| <--- 0; | |
N|| <--- srclen LSS dstlen; !MOVC5 | |
Z|| <--- srclen EQL dstlen; | |
V|| <--- 0; | |
C|| <--- srclen LSSU dstlen; |
28 | MOVC3 | Move Character 3 Operand |
2C | MOVC5 | Move Character 5 Operand |
In 3 operand format, the destination string specified by the length and destination address operands is replaced by the source string specified by the length and source address operands. In 5 operand format, the destination string specified by the destination length and destination address operands is replaced by the source string specified by the source length and source address operands. If the destination string is longer than the source string, the highest-addressed bytes of the destination are replaced by the fill operand. If the destination string is shorter than the source string, the highest-addressed bytes of the source string are not moved. The operation of the instruction is such that overlap of the source and destination strings does not affect the result.
Notes
R0 = | 0 |
R1 = | Address of 1 byte beyond the source string |
R2 = | 0 |
R3 = | Address of 1 byte beyond the destination string |
R4 = | 0 |
R5 = | 0 |
R0 = | Number of unmoved bytes remaining in source string. R0 is nonzero only if source string is longer than destination string |
R1 = | Address of 1 byte beyond last byte in source that was moved |
R2 = | 0 |
R3 = | Address of 1 byte beyond the destination string |
R4 = | 0 |
R5 = | 0 |
Move Translated Characters
opcode srclen.rw, srcaddr.ab, fill.rb, tbladdr.ab,
dstlen.rw, dstaddr.ab
N|| <--- srclen LSS dstlen; | |
Z|| <--- srclen EQL dstlen; | |
V|| <--- 0; | |
C|| <--- srclen LSSU dstlen; |
2E | MOVTC | Move Translated Characters |
The source string specified by the source length and source address operands is translated. It replaces the destination string specified by the destination length and destination address operands. Translation is accomplished by using each byte of the source string as an index into a 256-byte table whose first entry (entry number 0) address is specified by the table address operand. The byte selected replaces the byte of the destination string. If the destination string is longer than the source string, the highest-addressed bytes of the destination string are replaced by the fill operand. If the destination string is shorter than the source string, the highest-addressed bytes of the source string are not translated and moved. The operation of the instruction is such that overlap of the source and destination strings does not affect the result.If the destination string overlaps the translation table, the destination string is UNPREDICTABLE.
Notes
R0 = | Number of untranslated bytes remaining in source string; R0 is nonzero only if source string is longer than destination string |
R1 = | Address of 1 byte beyond the last byte in source string that was translated |
R2 = | 0 |
R3 = | Address of the translation table |
R4 = | 0 |
R5 = | Address of 1 byte beyond the destination string |
Move Translated Until Character
opcode srclen.rw, srcaddr.ab, esc.rb, tbladdr.ab,
dstlen.rw, dstaddr.ab
N|| <--- srclen LSS dstlen; | |
Z|| <--- srclen EQL dstlen; | |
V|| <--- {terminated by escape}; | |
C|| <--- srclen LSSU dstlen; |
2F | MOVTUC | Move Translated Until Character |
The source string specified by the source length and source address operands is translated. It replaces the destination string specified by the destination length and destination address operands. Translation is accomplished by using each byte of the source string as an index into a 256-byte table whose first entry address (entry number 0) is specified by the table address operand. The byte selected replaces the byte of the destination string. Translation continues until a translated byte is equal to the escape byte, or until the source string or destination string is exhausted. If translation is terminated because of escape, the condition code V-bit is set; otherwise, it is cleared.If the destination string overlaps the table, the destination string and registers R0 to R5 are UNPREDICTABLE. If the source and destination strings overlap and their addresses are not identical, the destination string and registers R0 to R5 are UNPREDICTABLE. If the source and destination string addresses are identical, the translation is performed correctly.
Notes
R0 = | Number of bytes remaining in source string (including the byte that caused the escape); R0 is zero only if the entire source string was translated and moved without escape |
R1 = | Address of the byte that resulted in destination string exhaustion or escape; or if no exhaustion or escape, address of 1 byte beyond the source string |
R2 = | 0 |
R3 = | Address of the table |
R4 = | Number of bytes remaining in the destination string |
R5 = | Address of the byte in the destination string that would have received the translated byte that caused the escape or would have received a translated byte if the source string were not exhausted; or if no exhaustion or escape, the address of 1 byte beyond the destination string |
Previous | Next | Contents | Index |
Copyright © Compaq Computer Corporation 1998. All rights reserved. Legal |
4515PRO_025.HTML
|