360 Assembly/360 Instructions/EX
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.
Purpose of Instruction
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 Faults
- 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.