Академический Документы
Профессиональный Документы
Культура Документы
Statement Format
Position
Position
Position
Position
Position
1- 8 Name
9 Blank
10 -14 Mnemonic Code
15 Blank
16 Onwards Operands
Statement Format
Position 72 Continuation
Character
Position 73 80 Sequence
numbers for identification
* in Position 1 indicates a
comment line
Addressing
Address is used to refer each byte
in VIRTUAL Storage
Maximum VIRTUAL Storage is 2GB
231
Hence an Address on OS/390 is
represented in a FULLWORD i.e. 4
bytes or 32 bits
Where is the 1 bit missing?
Addressing
In original MVS versions maximum
virtual memory was 16MB 224
(The LINE)
From MVS/XA onwards this was
enhanced to 2GB 231
To provide backward compatibility,
one bit was reserved
Addressing
This addressing is also called AMODE
AMODE 24 and 31
AMODE goes hand-in-hand with where data is
located/residing in virtual storage
Addressing
Any location is always translated
into base and displacement form
Abs Addr = Base Addr +
Displacement
Establishing a base is also called
ADDRESSABILITY
Assembler requires to establish
addressability, if items need to be
addressed with location names
Registers
IBM provides many types of REGISTERS
Registers
Used as
Now,
Machine Instructions
Based on types of OPERANDS
RR Register-Register
RX Register-Index
RS Register-Storage
SI Storage-Immediate
S Storage
SS1 Storage-Storage Type 1
SS2 Storage-Storage Type 2
Machine Instructions
First byte of instruction has OPCODE
(Operation Code)
Following bytes are operands
Registers (Base or Index) take 4 bits i.e.
nibble i.e. half word
Displacement requires 12 bits i.e. 3 nibbles
Immediate operands require 1 byte i.e. 8
bits
Length requires 1 byte (with exception od
SS2 instruction type where 2 lengths are
stored in 1 byte)
Machine Instructions
Data Types
Hexadecimal
Character
Binary
Halfword
Fullword
DoubleWord
Address Absolute
External Address
Packed
X (1 Byte)
C (1 Byte)
B (1 Byte)
H (2 Bytes)
F (4 Bytes)
D (8 bytes)
A (4 Bytes)
V (4 Bytes)
P (1 Byte)
Data Types
Each data type follows its boundary
alignment
Fullword, Address (External and Absolute)
are aligned at FULLWORD boundary i.e.
stored at an address divisible by 4
Halfword is aligned at HALFWORD
boundary i.e. stored at an address
divisible by 2
Character, Hexadecimal, Packed and
Binary are aligned at byte boundary i.e.
stored at an address divisible by 1
Doubleword is aligned at DOUBLEWORD
boundary i.e. stored at an address
divisible by 8
Data Definition
DS Define Storage
Label DS
DC Define Constants
Label DC
C1
Duplicator 1
Type C for Character
Modifier - L8 indicating length of 8
Initial TESTPROG
Data Definition
VAR1 DS C
Define a character
storage
VAR2 DS CA Define a character
constant initialized with A
VAR3 DS CL10
Define a
character storage of length 10
VAR4 DS 2CL10 Define 2
character storages of length 10
VAR5 DS FL1 Define a fullword
storage of length 1
Data Definition
Fullword is 4 bytes Why Length 1 ?
VAR1 DS C /*Start address 0000FF00*/
VAR2 DS F /*Start address 0000FF04*/
LOAD/STORE/MOVE/BRANC
H Instructions
LOAD RX Type
The LOAD instruction takes four
bytes from storage or from a general
register and place them unchanged into
a general purpose register.
Abbreviated as L.
Instruction format:
L
R1,D2(X2,B2)
R6,4(R5,R12)
LOAD R6 FROM R5 ADDRESS + R12
ADDRESS + 4
L
R14,FULLWORD
LOAD R14 FROM "FULLWORD"
LA (LOAD ADDRESS)
LM (LOAD MULTIPLE)
LH (LOAD HALFWORD)
LR (LOAD REGISTER)
Examples of LA Instruction
LA R6,4(R5,R12)
LOAD R6 WITH R5 ADDRESS + R12
ADDRESS + 4
LA R14,1(,R14)
ADD 1 TO VALUE IN R14
LM R14,R12,12(R13)
LOAD REGISTERS 14 THROUGH 12
FROM 15 CONSECUTIVE WORDS AT
ADDRESS IN R13 PLUS DECIMAL 12
LOAD HALFWORD RX
Type
The LOAD HALFWORD instruction
places unchanged a halfword from
storage into the right half of a register.
The left half of the register is loaded
with zeros or ones according to the
sign (leftmost bit) of the halfword.
Abbreviated as LH.
Instruction format:
LH R1,D2(X2,B2)
Examples of LH Instruction
LH R6,0(0,14)
Register 14 contains 00 00 18 03.
Locations 1803-1804 contain 00 20.
After the instruction is executed, register
contains 00 00 00 20. If locations 18031804 had contained a negative number, for
example, A7 B6, a minus sign would have
been propagated to the left, giving FF FF A7
B6 as the final result in register 6.
Examples of LR Instruction
LR
R6,R5
COPY R5 INTO R6
LR R7,R7
COPY R7 INTO ITSELF
INSERT CHARACTERRX
Type
The INSERT CHARACTER instruction
inserts the single byte addressed by the
second operand into the rightmost byte
(bits 55-63) of the first operand register.
The remaining bytes of the first operand
register remain unchanged.
Abbreviated as IC
Instruction format:
IC R1,D2(X2,B2)
Examples of IC Instruction
IC R11,=C'
INSERT LITERAL CONSISTING OF A SINGLE
BLANK INTO RIGHTMOST BYTE OF R11
IC R2,0(R3,R8)
INSERT BYTE AT ADDRESS IN R3 +
ADDRESS IN R8 INTO RIGHTMOST BYTE OF
R2
INSERT CHARACTERS
UNDER MASK RS Type
ICM R5,B'0111',FIELDA
FIELDA:
FE DC BA
Register 5 (before):
12 34 56 78
Register 5 (after):
12 FE DC BA
ICM 6,B'1001',FIELDB
FIELDB:
12 34
Register 6 (before):
00 00 00 00
Register 6 (after):
12 00 00 34
STORE Instruction RX
Type
The STORE instruction stores the
rightmost four bytes of a general
purpose register (the R1 value) at
a fullword location in main storage.
Abbreviated as ST.
Instruction format
ST R1,D2(X2,B2)
ST R6,4(R5,R12)
STORE RIGHT 4 BYTES IN R6 AT R5
ADDRESS + R12 ADDRESS + 4
ST R14,FULLWORD
STORE RIGHT 4 BYTES IN R14 AT
"FULLWORD"
STORE HALFWORD RX
Type
The STORE HALFWORD
instruction stores the rightmost 2
bytes (bits 48-63) of a general
purpose register (the R1 value)
into a 2 byte halfword in main
storage.
Abbreviated as STH.
Instruction format:
STH R1,D2(X2,B2)
STH R2,0(,R4)
STORE RIGHT MOST TWO BYTES OF
R2
IN R4
STH R14,HALFWORD
STORE 2 BYTES IN R14 IN
"HALFWORD"
STM R14,R12,12(R13)
STORE RIGHT HALF OF REGISTERS 14
THROUGH 12 AT 15 CONSECUTIVE
WORDS AT ADDRESS IN R13 PLUS
DECIMAL 12
STORE CHARACTER RX
Type
The STORE CHARACTER instruction
stores bits 56-63 (rightmost byte)
of the general purpose register
specified by the first operand at
the second operand address.
Abbreviated as STC.
Instruction format:
STC R1,D2(X2,B2)
STC R8,BYTE
STORE RIGHTMOST BYTE OF R8 AT
LABEL "BYTE"
STC R14,4(,R6)
STORE RIGHTMOST BYTE OF R14 4
BYTES PAST ADDRESS IN R6
STORE CHARACTER
UNDER MASK RS Type
STCM
8,B'0111',FIELD3
Register 8:
12 34 56 78
FIELD3 (before): not significant
FIELD3 (after) : 34 56 78
MOVE Instructions
Various MOVE Instructions are
MVC 10(256,R5),0(R5)
MOVE 256 BYTES FROM R5 ADDRESS
TO
R5 PLUS 10 (DECIMAL) ADDRESS
MVC TITLE(7),=C'1 ERROR
MOVE 7 BYTE LITERAL TO "TITLE"
ADDRESS
MVCIN 10(128,R3),0(R5)
MOVE 128 BYTES AT ADDRESS IN R5 TO
R3 ADDRESS +10 AND REVERSE THEIR
ORDER
MVCL
The second operand even numbered
register contains the address of the
sending field.
The second operand odd numbered
register contains the length of the
sending field in the right 3 bytes and an
optional padding character in the
leftmost byte. The padding character is
used to pad the receiving field if the
second operand length is less than the
first operand length.
MVI 10(R4),X'10'
MOVE A X'10' TO R4+X'10
MVI SWITCH,C' '
MOVE A BLANK TO 'SWITCH
MVZ 10(128,R3),0(R5)
MOVE ZONE PORTION OF 128 BYTES
FROM R5 ADDRESS TO R3 ADDRESS
+ 10
MVN 10(128,R3),0(R5)
MOVE NUMERICS OF 128 BYTES
FROM
R5 ADDRESS TO R3 + 10
BRANCH Instructions
Various BRANCH Instructions
B (BRANCH)
BC (BRANCH ON CONDITION)
BCT (BRANCH ON COUNT)
BCTR (BRANCH ON COUNT REGISTER)
BAL (BRANCH AND LINK)
BAS (BRANCH AND SAVE)
BSM (BRANCH AND SET MODE)
BASR (BRANCH AND SAVE REGISTER)
BAKR (BRANCH AND STACK)
BASSM (BRANCH AND SAVE AND SET MODE)
Unconditional BRANCH
Instructions
BRANCH (B)
BRANCH REGISTER (BR)
Conditional BRANCH
Instructions
BH or BHR
BL or BLR
BE or BER
BO or BOR
BP or BPR
BM or BMR
BZ
Branch on A High
Branch on A Low
Branch on A Equal B
Branch on Overflow
Branch on Plus
Branch on Minus
Branch on Zero
BRANCH Instruction
Format
XXX
XXXR
XXX
XXXXL
D2(X2,B2)
R2
label
label
B
4(R15)
UNCONDITIONAL BRANCH TO ADDRESS
IN R15 + 4
BH LOOPA
BRANCH TO "LOOPA" LABEL IF FIRST
COMPARED OPERAND IS HIGH
BR R1
UNCONDITIONAL BRANCH TO ADDRESS IN
R1
BRANCH ON COUNT
The BRANCH ON COUNT instruction is
used to branch to a storage location
whose address is specified by the
second operand of the instruction, if the
value in the first operand register is
non-zero after one is subtracted from it.
Abbreviated as BCT.
Instruction format:
BCT R1,D2(X2,B2)
BCT R4,100(,R11)
BRANCH TO ADDRESS IN R11 PLUS
100
BYTES IF R4 VALUE MINUS ONE IS
NOT
ZERO
BCT R5,ENDOFILE
BRANCH TO "ENDOFILE" LABEL IF R5
MINUS 1 IS NOT ZERO
BRANCH ON COUNT
REGISTER
The BRANCH ON COUNT REGISTER
instruction is used to branch to a
storage location whose address is
specified by the second operand of the
instruction, if the value in the first
operand register is non-zero after one is
subtracted from it.
Abbreviated as BCTR.
Instruction format:
BCTR R1,R2
BCTR R4,R15
BRANCH TO ADDRESS IN R15 IF R4
VALUE MINUS ONE IS NOT ZERO
BCTR R5,0
DECREMENT R5 BY 1, BUT DO NOT
BRANCH
Instruction format:
BAL R1,D2(X2,B2)
Example for BAL Instruction
BAL R14,CALCVAL
BRANCH TO "CALCVAL" LABEL- SAVE
ADDRESS OF NEXT INSTRUCTION IN
R14
BALR R14,R15
SAVE LINK INFO IN R14 AND
BRANCH
TO ADDRESS IN R15
BAS R14,CALCVAL
BRANCH TO "CALCVAL" LABEL - SAVE
ADDRESS OF NEXT INSTRUCTION IN
R14
BASR R14,R15
BRANCH TO ADDRESS IN R15 - SAVE
ADDRESS
OF NEXT INSTRUCTION IN R14
requiring 18F
R13 points to SAVEAREA as per IBMs convention
USING
STM
LR
ST
LR
LA
ST
CALLER
TESTDCB,R12
R14,R12,12(R13)
R12,R15
R13,SVAREA+4
R2,R13
R13,SVAREA
R13,8(R2)
Exit HouseKeeping
L
LM
L
BR
TESTPROG CSECT
USING
TESTDCB,R12
ESTABLISH R12 AS BASE REG
STM
R14,R12,12(R13)
SAVE CALLER'S REGS
LR
R12,R15
LOAD BASE REG, R15=CALLER ADDRESS
ST
R13,SVAREA+4
SAVE CALLER SAVEAREA POINTER
LR
R2,R13
TEMPORARY LOAD CALLER SAVEAREA
LA
R13,SVAREA
LOAD ADDRESS OF PROGRAMS SAVEAREA
ST
R13,8(R2)
SAVE PROGRAM SAVEAREA IN CALLER
--------------------------------------------------------L
R13,SVAREA+4
RESTORE CALLER SAVEAREA
LM
R14,R12,12(R13)
RESTORE CALLER'S REGS
L
R15,=F0
INITIALIZE RETURN CODE
BR
R14
BRANCH
SVAREA
DS
18F
END
TESTPROG
DS
OPEN
LTR
BNZ
GET
PUT
CLOSE
--------------MAIN$015
ERRFILE
ERRCLOSE
INFILE
DS
STH
STH
PUT
CLOSE
LTR
BNZ
B
ABEND
ABEND
DCB
OUTFILE
DCB
0H
(INFILE,INPUT,OUTFILE,OUTPUT)
OPEN THE INPUT & OPTPUT FILES
R15,R15
Q. OPEN SUCCESSFUL?
ERROPEN
A. NO, PROCESS OPEN ERROR
INFILE,TEMPAREA
READ THE INPUT FILE
OUTFILE,TEMPAREA
WRITE THE OUTPUT FILE
(INFILE,,OUTFILE)
CLOSE THE INPUT AND OUTPUT FILES
0H
R6,OUTAREA+64
STORE THE NUMBER OF TRAILERS
R9,OUTAREA
STORE THE TOTAL REC LEN IN RDW
OUTFILE,OUTAREA
WRITE THE OUTPUT FILE
(INFILE,,OUTFILE)
CLOSE THE INPUT AND OUTPUT FILES
R15,R15
Q. CLOSE SUCCESSFUL?
ERRCLOSE
A. NO, PROCESS CLOSE ERROR
RETURN
A. YES, EXIT THE PROGRAM
500,DUMP
500,DUMP
DDNAME=INPFILE0,MACRF=(GM),DSORG=PS,LRECL=25,
BLKSIZE=2500,RECFM=FB,EODAD=MAIN$015,SYNAD=ERRFILE
DDNAME=OUTFILE0,MACRF=(PM),DSORG=PS,LRECL=300,
BLKSIZE=2500,RECFM=FB,EODAD=MAIN$015,SYNAD=ERRFILE
X
X
BIT Manipulation
Instructions
AND (N)
AND IMMEDIATE (NI)
OR (O)
OR IMMEDIATE (OI)
EXCLUSIVE OR (X)
EXCLUSIVE OR IMMEDIATE (XI)
AND
The AND instruction ANDs the contents
of the four bytes addressed by the
second operand with the contents of the
first operand register. The logical AND
function is applied bit by bit; a bit in the
first operand register is set to one if
both corresponding bits in the first and
second operands are one.
Abbreviated as N.
Instruction format:
N
R1,D2(X2,B2)
N
R3,1000(R2,R6)
AND VALUE IN R3 WITH 4 BYTES AT
R2 ADDRESS + R6 ADDRESS + 1000
decimal
N
R7,=F'32767'
AND VALUE IN R7 WITH LITERAL
32,767
AND IMMEDIATE
The AND instruction logically
ANDS' the contents of the one
byte addressed by the second
operand with the byte of data
specified in the instruction.
Abbreviated as NI.
Instruction format:
NI D1(B1),I2
NI BYTE1,X'0F
AND VALUE AT BYTE1 WITH
IMMEDIATE
BYTE OF X'0F'
NI 0(R10),255
AND VALUE AT R10 ADDRESS PLUS 0
WITH IMMEDIATE BYTE OF 255
DECIMAL
OR
The O instruction performs a connective
logical Boolean "OR" function between
the 4 bytes in the register specified by
the first operand, and the 4 bytes in
storage addressed by the second
operand.
Abbreviated as O.
Instruction format:
O
R1,D1(X2,B2)
OR function table
2nd Operand Bit Values
0
1
+--------+--------+
|
|
|
0| 0
| 1 |
1st
|
|
|
Operand +--------+--------+
Bit
|
|
|
Values 1|
1|
1 |
|
|
|
+--------+--------+
O
R3,0(,R6)
"OR" R3 WITH 4 BYTES AT ADDRESS
IN
R6
O
R12,=X'00FF00FF'
"OR" R12 WITH 4 BYTE
HEXADECIMAL
CONSTANT
OR IMMEDIATE
The OI instruction performs a
logical connective Boolean OR"
function between the byte
addressed by the first operand,
and the byte of immediate data
specified by the second operand.
Abbreviated as OI.
Instruction format:
OI D1(B1),I2
OI 0(R4),X'40'
"OR" BYTE ADDRESSED BY R4 WITH
HEX LITERAL
OI FLAGBYTE,X'80'
"OR" "FLAGBYTE" WITH A X'80'
(DECIMAL
128)
EXCLUSIVE OR
The EXCLUSIVE OR instruction performs
a logical Boolean exclusive "OR"
function between the 4 bytes in the
right half of the register specified by the
first operand, and the 4 bytes in storage
addressed by the second operand.
Abbreviated as X.
Instruction format:
X
R1,D1(X2,B2)
EXCLUSIVE OR function
table
2nd Operand Bit Values
0
1
+--------+--------+
|
|
|
0| 0
| 1 |
1st
|
|
|
Operand +--------+--------+
Bit
|
|
|
Values 1|
1|
0 |
|
|
|
+--------+--------+
X
R3,0(,R6)
EXCLUSIVE "OR" R3 WITH 4 BYTES AT
ADDRESS IN R6
X
R12,=X'00FF00FF'
EXCLUSIVE "OR" R12 WITH 4 BYTE
HEXADECIMAL CONSTANT
EXCLUSIVE OR IMMEDIATE
The EXCLUSIVE OR IMMEDIATE
instruction performs a logical Boolean
exclusive "OR" function between the
byte addressed by the first operand,
and the byte of immediate data
specified by the second operand.
Abbreviated as XI.
Instruction format:
XI D1(B1),I2
XI 0(R4),X'40'
EXCLUSIVE "OR" BYTE ADDRESSED BY R4
WITH HEX ITERAL
XI FLAGBYTE,X'80'
EXCLUSIVE "OR" "FLAGBYTE" WITH A X'80'
(DEC. 128)
SLA R1,D2(B2)
SLA R10,12
SHIFT 31 BITS IN R10 LEFT 12 BIT POSITIONS
SLL R12,22
SHIFT 32 BITS IN R12 LEFT 22 BIT POSITIONS
R1,D2(B2)
SRA R10,12
SHIFT 31 BITS IN R10 RIGHT 12 BIT
POSITIONS
Abbreviated as SRL.
Instruction format
SRL R1,D2(B2)
SRL R10,12
SHIFT 32 BITS IN R10 RIGHT 12 BIT
POSITIONS
Arithmetic Instructions
ADD (A)
SUBTRACT (S)
MULTIPLY (M)
DIVIDE (D)
ADD RX Type
The ADD instruction algebraically
adds the value addressed by the
second operand to the contents of
the first operand register.
Abbreviated as A.
Instruction format
A
R1,D2(X2,B2)
A
R3,24(R5,R12)
ADD CONTENTS AT R5 ADDRESS +
R12
ADDRESS + 24 TO R3
A
R14,FULLWORD
ADD "FULLWORD" TO R14
A
R0,=F'1'
ADD 1 TO R0
AR R3,R2
ADD QUANTITY IN R3 TO R2
AR R8,R8
ADD VALUE IN R8 TO ITSELF
SUBTRACT RX Type
The SUBTRACT instruction
subtracts the value addressed by
the second operand from the
contents of the first operand
register.
Abbreviated as S.
Instruction format:
S
R1,D2(X2,B2)
R3,24(R5,R12)
SUBTRACT CONTENTS AT R5 ADDRESS +
R12
ADDRESS + 24 FROM R3
R14,FULLWORD
SUBTRACT "FULLWORD" FROM R14
R0,=F'1'
SUBTRACT 1 FROM R0
SUBTRACT REGISTER RR
Type
The SUBTRACT REGISTER
instruction subtracts the value in
the second operand register from
the contents of the first operand
register.
Abbreviated as SR.
Instruction format:
SR R1,R2
SR R3,R2
SUBTRACT CONTENT IN R2 FROM R3
SR R8,R8
SUBTRACT VALUE IN R8 FROM ITSELF
(RESULT IS 0)
MULTIPLY RX Type
The MULTIPLY instruction multiplies the
value in the odd-numbered register of
the first operand register pair by the
value in the word at the second operand
address.
The first operand must designate an
even-odd register pair. The initial
contents of the even-numbered register
are ignored; the result of the
multiplication occupies the first operand
even-odd register pair.
Abbreviated as M.
Instruction format:
M
R1,D2(X2,B2)
Examples for MULTIPLY Instruction
M
R2,0(R5,R6)
MULTIPLY VALUE IN R2 BY VALUE IN WORD
AT ADDRESS IN R5 + ADDRESS IN R6
M
R8,=F'100'
MULTIPLY VALUE IN R9 BY LITERAL 100
(DECIMAL)
MULTIPLE REGISTER RR
Type
The MULTIPLY REGISTER instruction
multiplies the value in the oddnumbered register of the first operand
register pair by the value in the second
operand register.
The first operand must designate an
even-odd register pair. The second
operand may designate any general
purpose register.
Abbreviated as MR.
Instruction format:
MR R1,R2
Examples for MR Instruction
MR
R2,R5
MR
R8,R9
DIVIDE RX Type
The DIVIDE instruction divides the
fullword value addressed by the second
operand (the divisor) into the 64-bit
signed value designated by the first
operand (the dividend). The first
operand must specify the evennumbered register of an even-odd
register pair.
Abbreviated as M.
Instruction format:
D
R1,D2(X2,B2)
Abbreviated as D.
Instruction format:
D
R1,D2(X2,B2)
D
R6,=F'300'
DIVIDE VALUE IN REGISTER R6-R7 BY
A
FULLWORD DECIMAL 300
DIVIDE REGISTER RR
Type
The DIVIDE REGISTER instruction
divides the fullword value in the second
operand register into the 64-bit signed
value which the even-odd register pair
designated by the first operand
contains.
After the division, the remainder (if any)
and quotient are contained in the even
and odd numbered registers,
respectively.
Abbreviated as DR.
Instruction format:
DR
R1,R2
DR R6,R9
DIVIDE 64-BIT VALUE IN
RIGHT HALVES OF
REGISTERS
R6 & R7 BY FULLWORD
VALUE
IN R9
F6 F7 F8 F9 F4 C5
MVZ P1+5(1),=C0
Result :
P1 :
F6 F7 F8 F9 F4 F5
77 88 99 0C
MVO P1,=X123456
Result :
P1 :
01 23 45 6C
SP SS2 Type
The SUBTRACT PACKED subtracts the
packed field pointed to by the second
operand address from the packed field
pointed to by the first operand address.
Both the first and second operand fields
being manipulated can be up to 16
bytes long.
Zero, -ve, +ve or decimal overflow condition
code will be set.
Instruction Format: SP
D1(L1,B1),D2(L2,B2)
SP SS2 Type
Example for SP Instruction:
P1 DC P-45
:
:
SP P1,=P1
Result :
P1 : 04 6D
Condition code 1 (-ve) is set.
DP SS2 Type
The first operand (dividend) is divided
by the second operand (the divisor).
The resulting quotient and remainder
are placed at the first-operand location.
The operands and results are in the
packed format.
The length in bytes of the divisor (2nd operand
packed field) must be
less than 8 bytes,
must also be less than the length in bytes
of the dividend
Instruction Format: DP
D1(L1,B1),D2(L2,B2)
DP SS2 Type
The result of the division replaces the first
operand packed field. The quotient is placed
leftmost in the first operand packed field, with
the remainder placed rightmost.
The length of the quotient is equal to the length
of the dividend(L1) minus the length of the
divisor(L2).
The length of the remainder is equal to the
length of the divisor (L2).
The sign of the quotient is determined by the
rules of algebra from the dividend and divisor
signs. The sign of the remainder has the same
value as the dividend sign. These rules hold
even when the quotient or remainder is zero.
DP SS2 Type
Example for DP Instruction:
FIELD1 : 01 23 45 67 8C
FIELD2 : 32 1D
DP FIELD1,FIELD2
Result :
FIELD 1 (after): 38 46 0D 01 8C
MP SS2 Type
The product of the first operand
(multiplicand) and the second operand
(multiplier) is placed at the first-operand
location. The operands and result are in
the packed format.
The length in bytes of the multiplier
must be
less than 8 bytes, and
must also be less than the length in bytes
of the multiplicand
Instruction Format: MP
D1(L1,B1),D2(L2,B2)
MP SS2 Type
The multiplicand must have at least as many
bytes of leftmost zeros as the number of bytes
in the multiplier; otherwise, a data exception
is recognized. This restriction ensures that no
product overflow occurs.
The product can't be bigger than 31 decimal
digits, plus the sign. The leftmost decimal digit
of the product will always be a zero.
The multiplication is done using the laws of
algebra, with the signs of both multiplicand
and multiplier determining the sign of the
product.
MP SS2 Type
Example for MP Instruction:
P1 DC P-38460
P2 DC P-321
P3 DS PL5
:
ZAP P3,P1
digits)
MP P3,P2
(Multiplicand)
(Multiplier)
Result :
P3 (after): 01 23 45 66 0C
CVD RX Type
The CONVERT TO DECIMAL instruction
converts the 4-byte signed binary
integer value in the rightmost half of
the first operand register to an
equivalent 8-byte packed decimal
value at the second operand address.
The second operand must designate a
doubleword on a doubleword boundary.
If the integer is +ve, the rightmost four bits of
the packed decimal result is encoded as
B'1100'; if ve, as B'1101'.
CVD RX Type
Example for CVD Instruction:
DWORD DC D0
R10 contains 00 00 0F 0F
CVD R10,DWORD
Result :
DWORD: 00 00 00 00 00 03 85 5C
(+3855)
CVB RX Type
The CONVERT TO BINARY instruction
converts the 8-byte packed decimal
value at the second operand address to
an equivalent signed binary integer in
the first operand register.
The second operand must designate a
doubleword on a doubleword boundary.
CVD RX Type
Example for CVB Instruction:
DWORD DS 0D
DC PL825,594
DWORD contains : 00 00 00 00 00 25 59 4C
CVD R10,DWORD
Result :
R10 :
00 00 63 FA
D1(L1,B1),D2(L2,B2)
01 23 4C
00 00 00 F1 F2 F3 F4 C4
(contd.)
(contd.)
(contd.)
4 5 6
20 20 6B 21 20 20
PWORK (after)
40 F6 6B F4 F5 F6
Result :
6 , 4 5 6
(contd.)
(contd.)
$6 , 4 5 6
MACROS
What is a macro? And what are its uses?
Macro Uses
Uses