Home > CBM > BASIC > Keywords > Tron | ||||||||||||||||||||||||||||||||||
TRON
Debugging; enable program tracing.
TRON turns on program tracing. Attempting to supply an argument to TRON will generate SYNTAX ERROR. When tracing is active, each statement exectuted in a BASIC program line will print the text "[line#]" (without quotes) to the current output device (usually the active video display screen; but see CMD). This is usefull to follow or verify the sequence of instructions executed by BASIC; particularly helpfull to debug complex IF/THEN/ELSE, ON...GOTO/GOSUB, or DO/EXIT/LOOP statements. However tracing can rapidly fill up the screen with [line#] messages and makes reading text of normal CHAR / PRINT commands difficult. In (non-split-screen) bitmap modes, the line number messages are usually not visible (an exception is possible with two monitors on the C128). For IF/THEN/ELSE, the IF keyword (which evaluates a condition) always causes a line# message to be printed. THEN never generates a line# message. ELSE will generate a line# message when it acts like REM (that is, when the IF condition was true and the THEN clause was executed). When the IF condition is false (i.e., the ELSE clause is selected) there will be no line# message corresponding to ELSE (similar to THEN). Note that the implied GOTO forms of THEN/ELSE never print a line# message. BEGIN never generates a line# message because it is a preposition to THEN/ELSE. BEND will generate a line# message when it ends an active BEGIN (i.e., it is acting like REM and is similar to ELSE), but BEND will not generate a message when BASIC is simply searching for a BEND (matching a previous BEGIN) in order to find an ELSE clause. Commands entered in direct mode will not generate a line# message, even when tracing is turned on. Statements in a program which are skipped also do not print a line# message. TROFF is normally used to turn off program tracing. The NEW command also turns off tracing, presumably to hide the fact that it changes the secret variable Text Pointer to the first line of the (just deleted) program. Example:
© H2Obsession, 2014 |