★ APPLICATIONS ★ PROGRAMMATION ★ TRACEBACK ★![]() |
| Traceback (The Amstrad User) | Applications Programmation |
An alternative to the TRON command and arguably more useful if the 464 traceback routine from Tony Jordan. Suppose you have just written a Basic program and you are now ready to try it out. You type RUN and hit the enter key. For a while the program rims normally then suddenly It crashes with an error message. You discover it has stopped In the middle of a sub-routine which should not yet have been reached. How on earth did the program enter that sub-routine? You could, of course, turn on trace with TRON at the 'Ready' prompt and rerun the program, but this is usually a slow and frustrating method of debugging. There is now a better solution with the Trace-back routine. OPERATION Traceback provides a post-mortem summary of what a program was doing before it crashed. It does this by (mainly) analysing Basic's run time stack. The stack is used: amongst other things, for keeping track of program flow during use of (he following control structures:
Traceback uses the stacked details to determine the line number of the statement which was executing when the control structure was invoked. There are three main possibilities:
As a bonus, Traceback also identifies where Basic's READ/RESTORE data pointer is pointing. If Traceback displayed "40 Data byte "n" this would indicate the pointer was positioned in the nth position of line 40. For example:
10 REM TEST PROGRAMwhen run, it aborts "Division by zero in 130"', Line 130 is seen to be within the .subroutine starling at line 120. This subroutine is railed from lines 60 and 90. Which of these calls resulted in the program aborting? |
| Keybd | Gosub | (latest stacked item) |
| 60 | Gosub | |
| 30 | For | |
| 20 | For | (earliest stacked item) |
| *No more* |
This display shows:
Traceback is a program development tool and as such should be a permanent part of a Basic program until it is debugged. This is because tape operations such as LOAD and MERGE destroy the run-time stack; if a program crashes and you then try to load and run Traceback you will always get a "Stack Empty" message. As written. Traceback is only suitable for use with the CPC464. For other CPCs it may be necessary to change the values of d.%. p.% and b.%. I do not know what these changes should be and if anyone does, please write in. Note: The command in line 50010 is DI (disable interrupt).
XREF OF TRACEBACK
48 References to 12 Symbols using 28 out of 600 nodes.
| ![]() |
|
Page créée en 444 millisecondes et consultée 2494 fois L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko. |