PRODAMP provides two predefined variables, OPC_TABLE and SVC_TABLE, to control access to internal DAMP tables. On the one hand, these variables can be used as normal numeric variables, i.e. you can assign values to them and use them in arithmetic expressions. However, the length of the variables is less than that of normal numeric variables and thus not every numeric variable can be assigned.
An assigned value is, however, also used as an index for localizing an entry within a DAMP table. This index can then be used to address symbols which describe this entry.
OPC_TABLE
This variable is 2 bytes long and is used as an index for an entry in the DAMP table which describes the instruction code and is used during disassembly. If the contents of OPC_TABLE are less than 256 (i.e. if only one byte is used), they are understood to be the operation code for an instruction. If the contents are greater than 255 (if 2 bytes are used), they are understood to be the first two bytes of an instruction, the second byte being a subcode. An entry in the instruction table is described by the following DSECT:
|
The following example is intended to illustrate how to address entries in the relevant DAMP table using the variable OPC_TABLE. As a prerequisite, a disassembly table must have been assigned, as is done when a diagnosis object is opened. If no such table has been assigned, you will need to declare one with the MODIFY-OBJECT-ASSUMPTIONS statement.
Example for OPC_TABLE
OPC_TABLE := X'B223'; MNEMO := ' '*7; PSEUDO := 'none'; INSTSVAL := P'40'; INSTSVMN := P'20'; INSTTYPE := OPC_TABLE.INSTTYPE; IF CURRENT.ERROR <> 0 THEN MESSAGE ( 'No instruction table available.' ); RETURN; END IF; IF INSTTYPE = 0 THEN MNEMO := 'invalid'; ELSIF INSTTYPE = 24 THEN MNEMO := 'unknown'; ELSE MNEMO := OPC_TABLE.INSTOMN; END IF; IF INSTSVAL + INSTSVMN IN OPC_TABLE.INSTFLAG THEN IF OPC_TABLE > 255 THEN PSEUDO := OPC_TABLE.INSTFMN; ELSE PSEUDO := ' '; END IF; END IF; MESSAGE ( 'Mnemonic: '+MNEMO+' Pseudo: '+Pseudo );
SVC_TABLE
This single-byte variable is used as an index for an entry in the internal DAMP SVC table, which contains an 8-byte mnemonic for each SVC. The symbol file does not include a DSECT for these entries. The entries must be described using an ARRANGE statement as illustrated by the example below.
Example for SVC_TABLE
SVC_TABLE := X'5C'; ARRANGE .MNEMO : TYPE = STRING, LENGTH = 8, OFFSET = 0; END ARRANGE; MNEMO := ' '*8; MNEMO := SVC_TABLE.MNEMO; IF CURRENT.ERROR <> 0 THEN MESSAGE ( 'No SVC table available.' ); ELSE MESSAGE ( 'SVC ' + HEX_STRING(SVC_TABLE,2)+' = '+MNEMO ); END IF;