Document revision date: 19 July 1999
|
|
|
|
VAX MACRO and Instruction Set Reference Manual
CVTSP
Convert Leading Separate Numeric to Packed
Format
opcode srclen.rw, srcaddr.ab, 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
09
|
CVTSP
|
Convert Leading Separate Numeric to Packed
|
Description
The source numeric string specified by the source length and source
address operands is converted to a packed decimal string, and the
destination string specified by the destination address and destination
length operands is replaced by the result.
Notes
- A reserved operand abort occurs if:
- The length of the source leading separate numeric string is outside
the range 0 to 31
- The length of the destination packed decimal string is outside the
range 0 to 31
- The source string contains an invalid byte. An invalid byte is any
character other than an ASCII "0" to "9" in a digit
byte or an ASCII "+", "<space>", or
"--" in the sign byte
- After execution:
R0 =
|
0
|
R1 =
|
Address of the sign byte of the source string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
destination string
|
- The destination string, R0 to R3, and the condition codes are
UNPREDICTABLE if the destination string overlaps the source string, or
if a reserved operand abort occurs.
- srclen is the length of the passed string minus
the sign byte.
CVTTP
Convert Trailing Numeric to Packed
Format
opcode srclen.rw, srcaddr.ab, tbladdr.ab, 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
26
|
CVTTP
|
Convert Trailing Numeric to Packed
|
Description
The source trailing numeric string specified by the source length and
source address operands is converted to a packed decimal string, and
the destination packed decimal string specified by the destination
address and destination length operands is replaced by the result.
Conversion is effected by using the highest-addressed (trailing) byte
of the source string as an unsigned index into a 256-byte table whose
first entry (entry number 0) is specified by the table address operand.
The byte read from the table replaces the highest-addressed byte of the
destination string (the byte containing the sign and the least
significant digit). The remaining packed digits of the destination
string are replaced by the low-order 4 bits of the corresponding bytes
in the source string.
Notes
- A reserved operand abort occurs if:
- The length of the source trailing numeric string is outside the
range 0 to 31
- The length of the destination packed decimal string is outside the
range 0 to 31
- The source string contains an invalid byte. An invalid byte is any
value other than ASCII "0" to "9" in any high-order
byte (that is, any byte except the least significant byte)
- The translation of the least significant digit produces an invalid
packed decimal digit or sign nibble
- After execution:
R0 =
|
0
|
R1 =
|
Address of the most significant digit of the source string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
destination string
|
- The destination string, R0 to R3, and the condition codes are
UNPREDICTABLE if the destination string overlaps the source string or
the table, or if a reserved operand abort occurs.
- If the convert instruction produces a --0 without overflow, the
destination packed decimal string is changed to a +0 representation,
condition code N is cleared, and Z is set.
- If the length of the source string is zero, the destination packed
decimal string is set equal to zero, and the translation table is not
referenced.
- 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.
- If the table translation produces a sign nibble containing any
valid sign, the preferred sign representation is stored in the
destination packed decimal string.
DIVP
Divide Packed
Format
opcode divrlen.rw, divraddr.ab, divdlen.rw,
divdaddr.ab, quolen.rw, quoaddr.ab
Condition Codes
N|| <--- {quo string} LSS 0;
|
|
Z|| <--- {quo string} EQL 0;
|
|
V|| <--- {decimal overflow};
|
|
C|| <--- 0;
|
|
Exceptions
- reserved operand
- decimal overflow
- divide by zero
Opcodes
Description
The dividend string specified by the dividend length and dividend
address operands is divided by the divisor string specified by the
divisor length and divisor address operands. The quotient string
specified by the quotient length and quotient address operands is
replaced by the result.
Notes
- This instruction allocates a 16-byte workspace on the stack. After
execution, the stack pointer (SP) is restored to its original contents,
and the contents of {(SP)--16}:{(SP)--1} are UNPREDICTABLE.
- The division is performed, resulting in the following conditions:
- The absolute value of the remainder (which is lost) is less than
the absolute value of the divisor
- The product of the absolute value of the quotient times the
absolute value of the divisor is less than or equal to the absolute
value of the dividend
- The sign of the quotient is determined by the rules of algebra from
the signs of the dividend and the divisor; if the value of the quotient
is zero, the sign is always positive
- After execution:
R0 =
|
0
|
R1 =
|
Address of the byte containing the most significant digit of the
divisor string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
dividend string
|
R4 =
|
0
|
R5 =
|
Address of the byte containing the most significant digit of the
quotient string
|
- The quotient string, R0 to R5, and the condition codes are
UNPREDICTABLE if: the quotient string overlaps the divisor or dividend
strings; the divisor or dividend string contains an invalid nibble; the
divisor is zero; or a reserved operand abort occurs.
MOVP
Move Packed
Format
opcode len.rw, srcaddr.ab, dstaddr.ab
Condition Codes
N|| <--- {dst string} LSS 0;
|
|
Z|| <--- {dst string} EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- C;
|
|
Exceptions
Opcodes
Description
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.
Notes
- 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
|
- 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.
- If the source is --0, the result is +0, N is cleared, and Z is set.
MULP
Multiply Packed
Format
opcode mulrlen.rw, mulraddr.ab, muldlen.rw,
muldaddr.ab, prodlen.rw, prodaddr.ab
Condition Codes
N|| <--- {prod string} LSS 0;
|
|
Z|| <--- {prod string} EQL 0;
|
|
V|| <--- {decimal overflow};
|
|
C|| <--- 0;
|
|
Exceptions
- reserved operand
- decimal overflow
Opcodes
Description
The multiplicand string specified by the multiplicand length and
multiplicand address operands is multiplied by the multiplier string
specified by the multiplier length and multiplier address operands. The
product string specified by the product length and product address
operands is replaced by the result.
Notes
- After execution:
R0 =
|
0
|
R1 =
|
Address of the byte containing the most significant digit of the
multiplier string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
multiplicand string
|
R4 =
|
0
|
R5 =
|
Address of the byte containing the most significant digit of the
product string
|
- The product string, R0 to R5, and the condition codes are
UNPREDICTABLE if: the product string overlaps the multiplier or
multiplicand strings; the multiplier or multiplicand strings contain an
invalid nibble; or a reserved operand abort occurs.
SUBP
Subtract Packed
Format
4operand: opcode sublen.rw, subaddr.ab,
diflen.rw, difaddr.ab
6operand: opcode sublen.rw, subaddr.ab,
minlen.rw, minaddr.ab,
diflen.rw, difaddr.ab
Condition Codes
N|| <--- {dif string} LSS 0;
|
|
Z|| <--- {dif string} EQL 0;
|
|
V|| <--- {decimal overflow};
|
|
C|| <--- 0;
|
|
Exceptions
- reserved operand
- decimal overflow
Opcodes
22
|
SUBP4
|
Subtract Packed 4 Operand
|
23
|
SUBP6
|
Subtract Packed 6 Operand
|
Description
In 4 operand format, the subtrahend string specified by the subtrahend
length and subtrahend address operands is subtracted from the
difference string specified by the difference length and difference
address operands, and the difference string is replaced by the result.
In 6 operand format, the subtrahend string specified by the subtrahend
length and subtrahend address operands is subtracted from the minuend
string specified by the minuend length and minuend address operands.
The difference string specified by the difference length and difference
address operands is replaced by the result.
Notes
- After execution of SUBP4:
R0 =
|
0
|
R1 =
|
Address of the byte containing the most significant digit of the
subtrahend string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
difference string
|
- After execution of SUBP6:
R0 =
|
0
|
R1 =
|
Address of the byte containing the most significant digit of the
subtrahend string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the most significant digit of the
minuend string
|
R4 =
|
0
|
R5 =
|
Address of the byte containing the most significant digit of the
difference string
|
- The difference string, R0 to R3 (R0 to R5 for SUBP6), and the
condition codes are UNPREDICTABLE if: the difference string overlaps
the subtrahend or minuend strings; the subtrahend, minuend, or
difference (4 operand only) strings contain an invalid nibble; or a
reserved operand abort occurs.
9.2.12 The EDITPC Instruction and Its Pattern Operators
The EDITPC instruction implements the common editing functions that
occur when handling fixed-format output. The operation consists of
converting an input packed decimal number to an output character string
and generating characters for the output. When converting digits,
options include filling in leading zeros, protecting leading zeros,
insertion of floating sign, insertion of floating currency symbol,
insertion of special sign representations, and blanking an entire field
when it is zero. An example of this operation is a MOVE to a numeric
edited (PICTURE) item in COBOL or PL/I. Many other applications are
possible.
The operands to the EDITPC instruction are as follows:
- A packed decimal string descriptor (as input).
This is a standard VAX operand pair consisting of the length of the
decimal string in digits (up to 31) and the starting address of the
string.
- A pattern specification, consisting of the
starting address of a pattern operation editing sequence. VAX MACRO
interprets a pattern specification in the same way as it interprets
normal instructions.
- The starting address of the output string. The
output string is described by its starting address only, because the
pattern defines the length unambiguously.
The EDITPC instruction manipulates two character registers and the four
condition codes:
The fill register (R2<7:0>) contains the fill
character. This is normally an ASCII blank but could be changed to an
asterisk (*), for instance, for check protection.
The sign register (R2<15:8>) contains the sign
character. Initially this register contains either an ASCII blank or a
minus sign (--), depending upon the sign of the input. You can change
the contents of this register to allow other sign representations such
as plus/minus or plus/blank. You can also manipulate it to output
special notations such as CR or DB. To implement a floating currency
sign, you can change the sign register to the currency sign.
After execution, the condition codes describe the following:
N
|
The sign of the input
|
Z
|
The presence of a zero source
|
V
|
An overflow condition
|
C
|
The presence of significant digits
|
Condition code N is determined at the start of the instruction and
remains unchanged (except for correcting a --0 input). The processor
computes and updates the other condition codes as the instruction
proceeds.
When the EDITPC instruction completes processing, registers R0 to R5
contain the values they would normally have after a decimal instruction.
EDITPC
Edit Packed to Character String
Format
opcode srclen.rw, srcaddr.ab, pattern.ab, dstaddr.ab
Condition Codes
N|| <--- {src string} LSS 0; !N <- 0 if src is -0
|
|
Z|| <--- {src string} EQL 0;
|
|
V|| <--- {decimal overflow}; !nonzero digits lost
|
|
C|| <--- {significance};
|
|
Exceptions
- reserved operand
- decimal overflow
Opcodes
38
|
EDITPC
|
Edit Packed to Character String
|
Description
The destination string specified by the pattern and destination address
operands is replaced by the edited version of the source string
specified by the source length and source address operands. The editing
is performed according to the pattern string, starting at the address
of the pattern operand and extending until a pattern end pattern
operator (EO$END) is encountered.
The pattern string consists of 1-byte pattern operators. Some pattern
operators take no operands. Some take a repeat count that is contained
in the rightmost nibble of the pattern operator itself. The rest take a
1-byte operand that immediately follows the pattern operator. This
operand is either an unsigned integer length or a byte character.
Table 9-1 lists the pattern operators that can be used with the
EDITPC instruction to form a pattern. Subsequent pages define each
pattern operator in a format similar to that of the normal instruction
descriptions. In each case, if there is an operand, it is either a
repeat count (r) from 1 to 15, an unsigned byte length (len), or a
character byte (ch). The encoding of the pattern operators is
represented graphically in Table 9-2.
See Appendix E for information about exceptions that affect the
EDITPC instruction.
Notes
- A reserved operand abort occurs if srclen GTRU 31.
- The destination string is UNPREDICTABLE if any of the following is
true:
- The source string contains an invalid nibble.
- The EO$ADJUST_INPUT operand is outside the range 1 to 31.
- The source and destination strings overlap.
- The pattern and destination strings overlap.
- After execution, the following general registers have contents as
specified:
R0 =
|
Length of source string
|
R1 =
|
Address of the byte containing the most significant digit of the source
string
|
R2 =
|
0
|
R3 =
|
Address of the byte containing the EO$END pattern operator
|
R4 =
|
0
|
R5 =
|
Address of 1 byte beyond the last byte of the destination string
|
If the destination string is UNPREDICTABLE, R0 to R5 and the
condition codes are UNPREDICTABLE.
- If V is set at the end and DV is enabled, a numeric overflow trap
occurs unless the conditions in note 9 are satisfied.
- The destination length is specified exactly by the pattern
operators in the pattern string. If the pattern is incorrectly formed
or if it is modified during the execution of the instruction, the
length of the destination string is UNPREDICTABLE.
- If the source is --0, the result may be --0 unless a fixup pattern
operator is included (EO$BLANK_ZERO or EO$REPLACE_SIGN).
- The contents of the destination string and the memory preceding it
are UNPREDICTABLE if the length covered by EO$BLANK_ZERO or
EO$REPLACE_SIGN is zero, or if it is outside the destination string.
- If more input digits are requested by the pattern than are
specified, a reserved operand abort is taken with R0 = --1 and R3 =
location of the pattern operator that requested the extra digit. The
condition codes and other registers are as specified in note 11. This
abort cannot be continued.
- If fewer input digits are requested by the pattern than are
specified, a reserved operand abort is taken with R3 = location of
EO$END pattern operator. The condition codes and other registers are as
specified in note 11. This abort cannot be continued.
- On an unimplemented or reserved pattern operator, a reserved
operand fault is taken with R3 = location of the faulting pattern
operator. The condition codes and other registers are as specified in
note 11. This fault can be continued as long as the defined register
state is manipulated according to the pattern operator description and
the state specified as "implementation dependent" is
preserved.
- On a reserved operand exception, as specified in notes 8 to 10, FPD
is set and the condition codes and registers are as follows:
N =
|
{
src has minus sign}
|
Z =
|
All source digits zero so far
|
V =
|
Nonzero digits lost
|
C =
|
Significance
|
R0<31:16> =
|
--(count of source zeros to supply)
|
R0<15:0> =
|
Remaining
srclen
|
R1 =
|
Current source location
|
R2<31:16> =
|
Implementation dependent
|
R2<15:8> =
|
Current contents of sign register
|
R2<7:0> =
|
Current contents of fill register
|
R3 =
|
Location of edit pattern operator causing exception
|
R4 =
|
Implementation dependent
|
R5 =
|
Location of next destination byte
|
Table 9-1 Summary of EDITPC Pattern Operators
Name |
Operand |
Summary |
Insert operators |
EO$INSERT
|
ch
|
Insert character, fill if insignificant
|
EO$STORE_SIGN
|
---
|
Insert sign
|
EO$FILL
|
r
|
Insert fill
|
Move operators |
EO$MOVE
|
r
|
Move digits, fill if insignificant
|
EO$FLOAT
|
r
|
Move digits, floating sign
|
EO$END_FLOAT
|
---
|
End floating sign
|
Fixup operators |
EO$BLANK_ZERO
|
len
|
Fill backward when 0
|
EO$REPLACE_SIGN
|
len
|
Replace with fill if --0
|
Load operators |
EO$LOAD_FILL
|
ch
|
Load fill character
|
EO$LOAD_SIGN
|
ch
|
Load sign character
|
EO$LOAD_PLUS
|
ch
|
Load sign character if positive
|
EO$LOAD_MINUS
|
ch
|
Load sign character if negative
|
Control operators |
EO$SET_SIGNIF
|
---
|
Set significance flag
|
EO$CLEAR_SIGNIF
|
---
|
Clear significance flag
|
EO$ADJUST_INPUT
|
len
|
Adjust source length
|
EO$END
|
---
|
End edit
|
Key:
- ch---One character
- r---Repeat count in the range 1 to 15
- len---Length in the range 1 to 255
Table 9-2 EDITPC Pattern Operator Encoding
Hex |
Symbol |
Notes |
00
|
EO$END
|
---
|
01
|
EO$END_FLOAT
|
---
|
02
|
EO$CLEAR_SIGNIF
|
---
|
03
|
EO$SET_SIGNIF
|
---
|
04
|
EO$STORE_SIGN
|
---
|
05...1F
|
---
|
Reserved to Digital
|
20...3F
|
---
|
Reserved for all time
|
40
|
EO$LOAD_FILL
|
Character is in next byte
|
41
|
EO$LOAD_SIGN
|
Character is in next byte
|
42
|
EO$LOAD_PLUS
|
Character is in next byte
|
43
|
EO$LOAD_MINUS
|
Character is in next byte
|
44
|
EO$INSERT
|
Character is in next byte
|
45
|
EO$BLANK_ZERO
|
Unsigned length is in next byte
|
46
|
EO$REPLACE_SIGN
|
Unsigned length is in next byte
|
47
|
EO$ADJUST_INPUT
|
Unsigned length is in next byte
|
48...5F
|
---
|
Reserved to Digital
|
60...7F
|
---
|
Reserved to CSS and customers
|
80,90,A0
|
---
|
Reserved to Digital
|
81...8F
|
EO$FILL
|
---
|
91...9F
|
EO$MOVE
|
Repeat count is <3:0>
|
A1...AF
|
EO$FLOAT
|
---
|
B0...FE
|
---
|
Reserved to Digital
|
FF
|
---
|
Reserved for all time
|