MVS Jan 2005.p65 - CBT Tape
MVS Jan 2005.p65 - CBT Tape
MVS Jan 2005.p65 - CBT Tape
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
TRAP2 and RP illustration<br />
This program illustrates the use of TRAP2 and RP (Resume<br />
Program) instructions.<br />
TRAP2 is a simple instruction that gives control to a routine in<br />
the current context of execution (AR/GR/PSW) and returns<br />
control wherever you want (next to TRAP2 or with PSW<br />
alteration), with modified or unmodified AR and GR. You have<br />
to make sure that the CPU is in the primary-space or AR mode,<br />
and bit 47 of DUCT is on.<br />
The following program runs a loop (eight times with BCT) and<br />
each time issues a TRAP2. TRAP2 gives control to a TRAP<br />
program, which prints R0, R1, R2, and PSW contents. And<br />
also, if the TRAP program finds that R2 contains F'2', it<br />
overwrites the instruction pointed to by the PSW (BCT) with a<br />
X'0101' (PR) to end the loop.<br />
This TRAP/RP pair can easily be used to design an on-line<br />
disassembler or debugger. Please read the comments in the<br />
code and refer to the Principles of Operation manual for more<br />
sophisticated code with TRAP and RP.<br />
CODE<br />
MYTRAP2 CSECT<br />
MYTRAP2 AMODE 31<br />
MYTRAP2 RMODE 24<br />
*=================================================================*<br />
* MODULE-NAME : MYTRAP2 *<br />
* DESCRIPTIVE-NAME: Shows TRAP/RP processing *<br />
* REQUIREMENTS : APF *<br />
* FUNCTION : *<br />
* Initialize TRAP environment, and issue an 8-times loop with *<br />
* a coded TRAP2 instruction. *<br />
* The TRAP takes control, displays GRØ-GR2 and PSW contents *<br />
* and resumes the program. *<br />
* The TRAP program also checks the content of GR2, if GR2=2 then *<br />
* it overwrites instruction (BCT) pointed to by PSW with a PR to *<br />
* end the main routine. *<br />
*=================================================================*<br />
© 2005. Reproduction prohibited. Please inform Xephon of any infringement.<br />
3