EX - EXecute - Opcode X / Decimal
- BCTR R1,0
- EX R1,LABEL
- LABEL PACK PACKIT,0(L,R3)
- L will be replaced with last byte value of R1
The EX instruction is available on all models, 360, 370 and z/System. EX (Execute)
EX R5,TARGET this has a purpose of modifying target code slightly before executing the target code. if the first operand isn't R0 then only the modifying target code possible.
here, as shown X(0) , this ZERO for declaring the length of bytes which are going to move from Y to X. while EXE instruction executed it will do the OR of rightmost byte in the register with field of length bits in MVC instruction. and now the TargetCODE means the MVC code here.
So,now here 4bytes will be copied from Y to X field. and We can change the field according to need through changing the value in the register5.
more example:: R4 = X
’00000005’ R5 = X
’FFFFFF04’ R6 = X
the values stored previously in those registers......
here some object codes shown for the target codes................... TARGET1 MVC FIELDA(0),FIELDB * Object code: D2 00 C0 10 C0 20
TARGET2 AP FIELDC(0),FIELDD(0) * Object code: FA 00 C0 22 C0 34
TARGET3 LR R0,R0 * Object code: 18 00
///////// as R4 has the rightmost byte=x'05'=05, so 6bytes will be copied from FIELDB TO FIELDA EX R4,TARGET1
///////// as R5 has the rightmost byte=x'04'=04, so 5bytes will be copied from FIELDB TO FIELDA
///////// as R6 has the rightmost byte=x'34'=52, so 53bytes will be copied from FIELDB TO FIELDA EX R6,TARGET1
////////as R6 has rightmost byte=x'34' so first nibble will go for FIELDC and second nibble will go for FIELDD
////// FIELDD (5 bytes) is added to FIELDC (4 bytes). and stored into FIELDC.
////////as there are two R0s means both nibbles together is x'00'
////////as R6 has rightmost byte=x'34' so,the object code will be x'18 34' after EX instruction execution
////////AND content of register4 will be loaded into register3
Purpose of InstructionEdit
The EX instruction is used to allow a program to modify itself in order to change certain arguments of other instructions without actually modifying the program's code. One use could be to move a string of 256 bytes or fewer, by executing an MVC instruction where the EX instruction changes the length value in that instruction.
The EX instruction ORs (not replace, OR) the low byte of the R1 register, with the 2nd byte (normally length) of the target instruction, which is then executed.
A 2nd use is to generate an intentional S0C3 abend, by coding Ex 0,* This produces a good dump and does not alter regs 14-1 as happens when the ABEND macro is used. This technique is not reserved for IBM use, as some have maintained.
Exceptions and FaultsEdit
- If the target instruction is itself an EX instruction, an Execute Exception occurs
- If the target instruction is not on an even address, an Address Exception occurs
- If the target instruction does not contain a valid opcode, an Operation Exception occurs
- If the target instruction is a privileged instruction, a Protect Violate exception occurs unless this task has the privileged bit in the PSW set
- If the instruction to be executed has an exception, that exception will be thrown
|360 Assembly Instructions||Next Instruction|
|360 Assembly Language|
|360 Family||Introduction · Basic FAQ · 360 Family · 360 Architecture|
|360 Instruction Set||360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions|
|Syntaxes and Assemblers||360 Assemblers· Pseudo Instructions|
|Instruction Extensions||Floating Point · High-Level Languages|
| This page or section is an undeveloped draft or outline.
You can help to develop the work, or you can ask for assistance in the project room.