This macro determines and display the target of an EXECUTE
instruction.
It is meant to be invoked with a PF key, but it can also be invoked
from the command line with an address.
/*REXX --------------------------------------------------------------*/
/* */
/* EX - DISASM the instruction which is the target of an */
/* EXecute instruction and display the results in a */
/* message. */
/* */
/* If the cursor is positioned on an EXecute instruction, or */
/* the cursor is on the command line but the address of a valid */
/* EXecute instruction has been entered, or if the PSW points */
/* to a valid EXecute instruction, dis-assemble the target of */
/* EXecute instruction and display the results as a message. */
/* */
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/* Determine which instruction is involved. */
/* */
/* If EXTRACT ARGUMENT gives RC¬=0, IDF will already have issued */
/* an error message. In this case, we exit with RC=-3 to prevent */
/* IDF from overlaying that message with another that says "MACRO */
/* RC=xx" if the argument came from the command line. */
/*-------------------------------------------------------------------*/
'EXTRACT ARGUMENT'
If RC ¬= 0 Then
Exit -3 /* RC=-3 to prevent msg overlay */
If source = '' Then /* no address provided */
Do
'EXTRACT VALUE 0(PSW)' /* use next instruction address */
field = Word(EXPR, 1)
End
address = field /* field level resolution */
'EXTRACT DISASM X'''address''''
If RC ¬= 0 | instr = '' Then /* not a valid instruction */
Do
'SET MSG Location' address 'does not contain a valid EXecute',
'instruction'
'SET ALARM'
Exit
End
Parse Var instr 13 index 14 . 15 base 16 offset 19 . 35 opcode .
/*-------------------------------------------------------------------*/
/* The opcode must be EX (execute) for this macro. */
/*-------------------------------------------------------------------*/
If opcode ¬= 'EX' Then
Do
'SET MSG' STRIP(opcode) 'is not a valid target for the EX macro'
Exit
End
/*-------------------------------------------------------------------*/
/* Now convert the hex index, base, and offset to an expression */
/*-------------------------------------------------------------------*/
reghex = '123456789ABCDEF'
oper = "X'"offset"'"
If index ¬= '0' Then
oper = oper'+0(R'index(reghex,index)')'
If base ¬= '0' Then
oper = oper'+0(R'index(reghex,base)')'
/*-------------------------------------------------------------------*/
/* Dump the indicated memory area and exit */
/*-------------------------------------------------------------------*/
'Extract Disasm' oper
'SET MSG' instr
Exit