18.08.2013 Views

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Program Trace Routine<br />

SNOOPY links to a user-supplied subroutine when it encounters a command that is not<br />

contained in the set of standard commands. (Because one-character abbreviations are<br />

permitted for most SNOOPY commands, the command cannot begin with the same<br />

letter as a SNOOPY command. Therefore, the commands should begin with a $<br />

character.)<br />

A user command routine is identified to SNOOPY by storing its address in H2 of the<br />

externally defined cell SNUCM$. If SNOOPY cannot recognize the command, the user<br />

routine must return to 0,X11; normal return is to 1,X11. The volatile register set can be<br />

used without saving and restoring it.<br />

When SNOOPY enters the user command routine, registers A1 and A2 contain the<br />

command in Fieldata, the command is left-justified and space-filled, register X2 contains<br />

the current program address (simulated P register), and X10 points to an area containing<br />

the program's simulated control registers. These registers are located offset to a<br />

location that corresponds to their absolute addresses; for example, A0 contents at<br />

014,X10, R5 contents at 0105,X10, and so on. The program can change the value in<br />

SNUCM$ at any time, even while SNOOPY is performing a trace. If it is set to zero,<br />

SNOOPY does not interpret any user commands.<br />

The command routine may reference SNOOPY's command reading routine and lexical<br />

scanner by performing an SLJ to SNGTC$. A0 should contain zero or a pointer to a<br />

TREAD$ packet before it calls SNGTC$.<br />

If register A0 = 0, SNOOPY will not read the input; the remainder of the line containing<br />

the user command will be scanned for information. If A0 contains a TREAD$ packet<br />

pointer, the calling program must specify the input buffer SNBUF$. On return from<br />

SNGTC$, register A0 is unchanged; A1 and A2 contain a Fieldata command which is<br />

left-justified and space-filled (unless A3 = 0); A3 contains the nonblank character count<br />

for A1 and A2; and register R1 has the terminated delimiter. If an entirely blank line is<br />

encountered, registers A3 = 0 and R1 = '/'.<br />

SNOOPY commands conform to element name syntax (alphabetics, numerics, “-”,<br />

and “$”).<br />

24.4.1. Contingency Processing<br />

In some cases, because of time constraints, it is undesirable to use SNOOPY to trace an<br />

entire program. Instead, SNOOPY can gain control only when a contingency occurs.<br />

To call a routine that does this, enter the following:<br />

SLJ SNCNT$<br />

After this calling sequence is read, the program proceeds normally until a contingency is<br />

encountered. When a contingency occurs, SNOOPY takes control and the simulated<br />

P register points to the contingency address + 1. A message indicating the nature of the<br />

error is printed. If the contingency is fatal and the program is in batch mode, SNOOPY<br />

exits (EXIT$). For nonfatal contingencies, the remainder of the program is executed.<br />

7833 1733–004 24–7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!