Document revision date: 30 March 2001

## VAX MACRO and Instruction Set Reference Manual

Previous | Contents | Index

#### 9.2.11.7 Instruction Descriptions

The following instructions are described in this section:

| Description and Opcode | Number of Instructions
--- | --- | ---
1. | Add Packed 4 Operand ADDP4 addlen.rw, addaddr.ab, sumlen.rw, sumaddr.ab, {R0-3.wl} | 1
2. | Add Packed 6 Operand ADDP6 add1len.rw, add1addr.ab, add2len.rw, add2addr.ab, sumlen.rw, sumaddr.ab, {R0-5.wl} | 1
3. | Arithmetic Shift and Round Packed ASHP cnt.rb, srclen.rw, srcaddr.ab, round.rb, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
4. | Compare Packed 3 Operand CMPP3 len.rw, src1addr.ab, src2addr.ab, {R0-3.wl} | 1
5. | Compare Packed 4 Operand CMPP4 src1len.rw, src1addr.ab, src2len.rw, src2addr.ab, {R0-3.wl} | 1
6. | Convert Long to Packed CVTLP src.rl, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
7. | Convert Packed to Long CVTPL srclen.rw, srcaddr.ab, {R0-3.wl}, dst.wl | 1
8. | Convert Packed to Leading Separate CVTPS srclen.rw, srcaddr.ab, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
9. | Convert Packed to Trailing CVTPT srclen.rw, srcaddr.ab, tbladdr.ab, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
10. | Convert Leading Separate to Packed CVTSP srclen.rw, srcaddr.ab, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
11. | Convert Trailing to Packed CVTTP srclen.rw, srcaddr.ab, tbladdr.ab, dstlen.rw, dstaddr.ab, {R0-3.wl} | 1
12. | Divide Packed DIVP divrlen.rw, divraddr.ab, divdlen.rw, divdaddr.ab, quolen.rw, quoaddr.ab, {R0-5.wl, -16(SP):-1(SP).wb} | 1
13. | Move Packed MOVP len.rw, srcaddr.ab, dstaddr.ab, {R0-3.wl} | 1
14. | Multiply Packed MULP mulrlen.rw, mulraddr.ab, muldlen.rw, muldaddr.ab, prodlen.rw, prodaddr.ab, {R0-5.wl} | 1
15. | Subtract Packed 4 Operand SUBP4 sublen.rw, subaddr.ab, diflen.rw, difaddr.ab, {R0-3.wl} | 1
16. | Subtract Packed 6 Operand SUBP6 sublen.rw, subaddr.ab, minlen.rw, minaddr.ab, diflen.rw, difaddr.ab, {R0-5.wl} | 1

## ADDP

> Add Packed

### Format

> opcode addlen.rw, addaddr.ab, sumlen.rw,

> sumaddr.ab opcode add1len.rw, add1addr.ab, add2len.rw,

> add2addr.ab, sumlen.rw, sumaddr.ab

### Condition Codes

N|| <--- {sum string} LSS 0; |
Z|| <--- {sum string} EQL 0; |
V|| <--- {decimal overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> decimal overflow

### Opcodes

20 | ADDP4 | Add Packed 4 Operand
21 | ADDP6 | Add Packed 6 Operand

### Description

> In 4 operand format, the addend string specified by the addend length and addend address operands is added to the sum string specified by the sum length and sum address operands, and the sum string is replaced by the result.

> In 6 operand format, the addend1 string specified by the addend1 length and addend1 address operands is added to the addend2 string specified by the addend2 length and addend2 address operands. The sum string specified by the sum length and sum address operands is replaced by the result.

Notes

1. After execution of ADDP4:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the addend string
   R2 = | 0
   R3 = | Address of the byte containing the most significant digit of the sum string

2. After execution of ADDP6:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the addend1 string
   R2 = | 0
   R3 = | Address of the byte containing the most significant digit of the addend2 string
   R4 = | 0
   R5 = | Address of the byte containing the most significant digit of the sum string

3. The sum string, R0 to R3 (or R0 to R5 for ADDP6) and the condition codes are UNPREDICTABLE if: the sum string overlaps the addend, addend1, or addend2 strings; the addend, addend1, addend2, or sum (4 operand only) strings contain an invalid nibble; or a reserved operand abort occurs.

## ASHP

> Arithmetic Shift and Round Packed

### Format

> opcode cnt.rb, srclen.rw, srcaddr.ab, round.rb,

> dstlen.rw, dstaddr.ab

### Condition Codes

N|| <--- {dst string} LSS 0; |
Z|| <--- {dst string} EQL 0; |
V|| <--- {decimal overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> decimal overflow

### Opcodes

F8 | ASHP | Arithmetic Shift and Round Packed

### Description

> The source string specified by the source length and source address operands is scaled by a power of 10 specified by the count operand. The destination string specified by the destination length and destination address operands is replaced by the result.

> A positive count operand effectively multiplies, a negative count effectively divides, and a zero count just moves and affects condition codes. When a negative count is specified, the result is rounded using the round operand.

Notes

1. After execution:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the source string
   R2 = | 0
   R3 = | Address of the byte containing the most significant digit of the destination string

2. The destination string, R0 to R3, and the condition codes are UNPREDICTABLE if the destination string overlaps the source string, the source string contains an invalid nibble, or a reserved operand abort occurs.
3. When the count operand is negative, the result is rounded by decimally adding bits 3:0 of the round operand to the most significant low-order digit discarded and propagating the carry, if any, to higher-order digits. Both the source operand and the round operand are considered to be quantities of the same sign for the purpose of this addition.
4. If bits 7:4 of the round operand are nonzero, or if bits 3:0 of the round operand contain an invalid packed decimal digit, the result is UNPREDICTABLE.
5. When the count operand is zero or positive, the round operand has no effect on the result except as specified in note 4.
6. The round operand is normally 5. Truncation can be accomplished by using a zero round operand.

## CMPP

> Compare Packed

### Format

> 3operand: opcode len.rw, src1addr.ab,

> src2addr.ab 4operand: opcode src1len.rw, src1addr.ab,

> src2len.rw, src2addr.ab

### Condition Codes

N|| <--- {src1 string} LSS {src2 string}; |
Z|| <--- {src1 string} EQL {src2 string}; |
V|| <--- 0; |
C|| <--- 0; |

#### Exceptions

> reserved operand

### Opcodes

35 | CMPP3 | Compare Packed 3 Operand
37 | CMPP4 | Compare Packed 4 Operand

### Description

> In 3 operand format, the source 1 string specified by the length and source 1 address operands is compared to the source 2 string specified by the length and source 2 address operands. The only action is to affect the condition codes.

> In 4 operand format, the source 1 string specified by the source 1 length and source 1 address operands is compared to the source 2 string specified by the source 2 length and source 2 address operands. The only action is to affect the condition codes.

Notes

1. After execution of CMPP3 or CMPP4:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of string1
   R2 = | 0
   R3 = | Address of the byte containing the most significant digit of string2

2. R0 to R3 and the condition codes are UNPREDICTABLE if the source strings overlap, if either string contains an invalid nibble, or if a reserved operand abort occurs.

## CVTLP

> Convert Long to Packed

### Format

> opcode src.rl, dstlen.rw, dstaddr.ab

### Condition Codes

N|| <--- {dst string} LSS 0; |
Z|| <--- {dst string} EQL 0; |
V|| <--- {decimal overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> decimal overflow

### Opcodes

F9 | CVTLP | Convert Long to Packed

### Description

> The source operand is converted to a packed decimal string. The destination string operand specified by the destination length and destination address operands is replaced by the result.

Notes

1. After execution:

   R0 = | 0
   R1 = | 0
   R2 = | 0
   R3 = | Address of the byte containing the most significant digit of the destination string

2. The destination string, R0 to R3, and the condition codes are UNPREDICTABLE on a reserved operand abort.
3. Overlapping operands produce correct results.

## CVTPL

> Convert Packed to Long

### Format

> opcode srclen.rw, srcaddr.ab, dst.wl

### Condition Codes

N|| <--- dst LSS 0; |
Z|| <--- dst EQL 0; |
V|| <--- {integer overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> integer overflow

### Opcodes

36 | CVTPL | Convert Packed to Long

### Description

> The source string specified by the source length and source address operands is converted to a longword, and the destination operand is replaced by the result.

Notes

1. After execution:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the source string
   R2 = | 0
   R3 = | 0

2. The destination operand, R0 to R3, and the condition codes are UNPREDICTABLE on a reserved operand abort, or if the string contains an invalid nibble.
3. The destination operand is stored after the registers are updated as specified in note 1. You may use R0 to R3 as the destination operand.
4. If the source string has a value outside the range -2,147,483,648 to +2,147,483,647, integer overflow occurs and the destination operand is replaced by the low-order 32 bits of the correctly signed infinite precision conversion. On overflow, the sign of the destination may be different from the sign of the source.
5. Overlapping operands produce correct results.

## CVTPS

> Convert Packed to Leading Separate Numeric

### Format

> opcode srclen.rw, srcaddr.ab, dstlen.rw, dstaddr.ab

### Condition Codes

N|| <--- {src string} LSS 0; |
Z|| <--- {src string} EQL 0; |
V|| <--- {decimal overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> decimal overflow

### Opcodes

08 | CVTPS | Convert Packed to Leading Separate Numeric

### Description

> The source packed decimal string specified by the source length and source address operands is converted to a leading separate numeric string. The destination string specified by the destination length and destination address operands is replaced by the result.

> Conversion is effected by replacing the lowest-addressed byte of the destination string with the ASCII character "+" or "-", determined by the sign of the source string. The remaining bytes of the destination string are replaced by the ASCII representations of the values of the corresponding packed decimal digits of the source string.

Notes

1. After execution:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the source string
   R2 = | 0
   R3 = | Address of the sign byte of the destination string

2. The destination string, R0 to R3, and the condition codes are UNPREDICTABLE if the destination string overlaps the source string, the source string contains an invalid nibble, or a reserved operand abort occurs.

3. This instruction produces an ASCII "+" or "-" in the sign byte of the destination string.
4. If decimal overflow occurs, the value stored in the destination might be different from the value indicated by the condition codes (Z and N bits).
5. If the conversion produces a -0 without overflow, the destination leading separate numeric string is changed to a +0 representation.

## CVTPT

> Convert Packed to Trailing Numeric

### Format

> opcode srclen.rw, srcaddr.ab, tbladdr.ab, dstlen.rw,

> dstaddr.ab

### Condition Codes

N|| <--- {src string} LSS 0; |
Z|| <--- {src string} EQL 0; |
V|| <--- {decimal overflow}; |
C|| <--- 0; |

#### Exceptions

> reserved operand
> decimal overflow

### Opcodes

24 | CVTPT | Convert Packed to Trailing Numeric

### Description

> The source packed decimal string specified by the source length and source address operands is converted to a trailing numeric string. The destination string specified by the destination length and destination address operands is replaced by the result. The condition code N and Z bits are affected by the value of the source packed decimal string.

> Conversion is effected by using the highest-addressed byte of the source string (the byte containing the sign and the least significant digit), even if the source string value is -0. The assembler uses this byte as an unsigned index into a 256-byte table whose first entry (entry number 0) address is specified by the table address operand. The byte read from the table replaces the least significant byte of the destination string. The remaining bytes of the destination string are replaced by the ASCII representations of the values of the corresponding packed decimal digits of the source string.

Notes

1. After execution:

   R0 = | 0
   R1 = | Address of the byte containing the most significant digit of the source string
   R2 = | 0
   R3 = | Address of the most significant digit of the destination string

2. The destination string, R0 to R3, and the condition codes are UNPREDICTABLE if the destination string overlaps the source string or the table; if the source string or the table contains an invalid nibble; or if a reserved operand abort occurs.
3. The condition codes are computed on the value of the source string even if overflow results. In particular, condition code N is set only if the source is nonzero and contains a minus sign (-).
4. By appropriate specification of the table, you can convert any form of trailing numeric string. See Chapter 8 for the preferred form of trailing overpunch, zoned and unsigned data. In addition, the table can be set up for absolute value, negative absolute value, or negated conversions. The translation table may be referenced even if the length of the destination string is zero.
5. Decimal overflow occurs if the destination string is too short to contain the converted result of a nonzero packed decimal source string (not including leading zeros). Conversion of a source string with zero value never results in overflow; conversion of a nonzero source string to a zero-length destination string results in overflow.
6. If decimal overflow occurs, the value stored in the destination may be different from the value indicated by the condition codes (Z and N bits).

Previous | Next | Contents | Index

| privacy and legal statement |
4515PRO_027.HTML