 |
VAX MACRO and Instruction Set Reference Manual
SUB
Subtract
Format
2operand: opcode sub.rx, dif.mx
3operand: opcode sub.rx, min.rx, dif.wx
Condition Codes
N|| <--- dif LSS 0;
|
|
Z|| <--- dif EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
floating overflow
floating underflow
reserved operand
Opcodes
42
|
SUBF2
|
Subtract F_floating 2 Operand
|
43
|
SUBF3
|
Subtract F_floating 3 Operand
|
62
|
SUBD2
|
Subtract D_floating 2 Operand
|
63
|
SUBD3
|
Subtract D_floating 3 Operand
|
42FD
|
SUBG2
|
Subtract G_floating 2 Operand
|
43FD
|
SUBG3
|
Subtract G_floating 3 Operand
|
62FD
|
SUBH2
|
Subtract H_floating 2 Operand
|
63FD
|
SUBH3
|
Subtract H_floating 3 Operand
|
Description
In 2 operand format, the subtrahend operand is subtracted from the
difference operand, and the difference is replaced by the rounded
result. In 3 operand format, the subtrahend operand is subtracted from
the minuend operand, and the difference operand is replaced by the
rounded result.
Notes
- On a reserved operand fault, the difference operand is unaffected,
and the condition codes are UNPREDICTABLE.
- On floating underflow, if FU is set, a fault occurs. Zero is stored
as the result of floating underflow only if FU is clear. On a floating
underflow fault, the difference operand is unaffected. If FU is clear,
the difference operand is replaced by zero, and no exception occurs.
- On floating overflow, the instruction faults, the difference
operand is unaffected, and the condition codes are UNPREDICTABLE.
TST
Test
Format
opcode src.rx
Condition Codes
N|| <--- src LSS 0;
|
|
Z|| <--- src EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
reserved operand
Opcodes
53
|
TSTF
|
Test F_floating
|
73
|
TSTD
|
Test D_floating
|
53FD
|
TSTG
|
Test G_floating
|
73FD
|
TSTH
|
Test H_floating
|
Description
The condition codes are affected according to the value of the source
operand.
Notes
- TSTx src is equivalent to CMPx
src, #0, but is 5 (F_floating) or 9 (D_floating or
G_floating) or 17 (H_floating) bytes shorter.
- On a reserved operand fault, the condition codes are UNPREDICTABLE.
9.2.9 Character String Instructions
A character string is specified by the following two operands:
- An unsigned word operand that specifies the length of the
character string in bytes.
- The address of the lowest-addressed byte of the character string.
This is specified by a byte operand of address access type.
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
|
CMPC
Compare Characters
Format
3operand: opcode len.rw, src1addr.ab,
src2addr.ab
5operand: opcode src1len.rw, src1addr.ab, fill.rb,
src2len.rw, src2addr.ab
Condition Codes
N|| <--- {first byte} LSS {second byte};
|
|
Z|| <--- {first byte} EQL {second byte};
|
|
V|| <--- 0;
|
|
C|| <--- {first byte} LSSU {second byte};
|
|
Exceptions
None.
Opcodes
29
|
CMPC3
|
Compare Characters 3 Operand
|
2D
|
CMPC5
|
Compare Characters 5 Operand
|
Description
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
- After execution of CMPC3:
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
|
- After execution of CMPC5:
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
|
- If both strings have zero length, condition code Z is set and N, V,
and C are cleared just as in the case of two equal strings.
LOCC
Locate Character
Format
opcode char.rb, len.rw, addr.ab
Condition Codes
N|| <--- 0;
|
|
Z|| <--- R0 EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
None.
Opcodes
Description
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
- After execution:
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
|
- If the string has zero length, condition code Z is set just as
though each byte of the entire string were unequal to character.
MATCHC
Match Characters
Format
opcode objlen.rw, objaddr.ab, srclen.rw, srcaddr.ab
Condition Codes
N|| <--- 0;
|
|
Z|| <--- R0 EQL 0; !match found
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
None.
Opcodes
39
|
MATCHC
|
Match Characters
|
Description
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
- After execution:
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
|
For zero-length source and object strings, R3 and R1 contain the
source and object addresses, respectively.
- If both strings have zero length, or if the object string has zero
length, condition code Z is set, and registers R0 to R3 are left just
as though the substring were found.
- If the source string has zero length and the object string has
nonzero length, condition code Z is cleared, and registers R0 to R3 are
left just as though the substring were not found.
MOVC
Move Character
Format
3operand: opcode len.rw, srcaddr.ab, dstaddr.ab
5operand: opcode srclen.rw, srcaddr.ab, fill.rb,
dstlen.rw, dstaddr.ab
Condition Codes
N|| <--- 0; !MOVC3
|
|
Z|| <--- 1;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
|
|
N|| <--- srclen LSS dstlen; !MOVC5
|
|
Z|| <--- srclen EQL dstlen;
|
|
V|| <--- 0;
|
|
C|| <--- srclen LSSU dstlen;
|
|
Exceptions
None.
Opcodes
28
|
MOVC3
|
Move Character 3 Operand
|
2C
|
MOVC5
|
Move Character 5 Operand
|
Description
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
- After execution of MOVC3:
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
|
- After execution of MOVC5:
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
|
- MOVC3 is the preferred way to copy one block of memory to another.
- MOVC5 with a zero source length operand is the preferred way to
fill a block of memory with the fill character.
MOVTC
Move Translated Characters
Format
opcode srclen.rw, srcaddr.ab, fill.rb, tbladdr.ab,
dstlen.rw, dstaddr.ab
Condition Codes
N|| <--- srclen LSS dstlen;
|
|
Z|| <--- srclen EQL dstlen;
|
|
V|| <--- 0;
|
|
C|| <--- srclen LSSU dstlen;
|
|
Exceptions
None.
Opcodes
2E
|
MOVTC
|
Move Translated Characters
|
Description
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
- After execution:
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
|
|