Home
CBM
  ASCII-X
  BASIC
    Disk Commands
    Enter RUN mode
    Program Format
    Secret Variables
    Variable Format
    Expressions
    Keywords
      (divide)
      (equal)
      (less)
      (minus)
      (more)
      (multiply)
      (plus)
      (power)
      Abs
      And
      Append
      Asc
      Atn
      Auto
      Backup
      Bank
      Begin
      Bend
      Bload
      Boot
      Box
      Bsave
      Bump
      Catalog
      Char
      Chr
      Circle
      Close
      Clr
      Cmd
      Collect
      Collision
      Color
      Concat
      Cont
      Copy
      Cos
      Data
      Dclear
      Dclose
      Dec
      Def
      Delete
      Dim
      Directory
      Dispose
      Dload
      Do
      Dopen
      Draw
      Ds
      Ds string
      Dsave
      Dverify
      El
      Else
      End
      Envelope
      Er
      Err
      Exit
      Exp
      Fast
      Fetch
      Filter
      Fn
      For
      Fre
      Get
      Get num
      Getkey
      Go
      Gosub
      Goto
      Graphic
      Gshape
      Header
      Help
      Hex
      If
      Input
      Input num
      Instr
      Int
      Joy
      Key
      Left
      Len
      Let
      List
      Load
      Locate
      Log
      Loop
      Mid
      Monitor
      Movspr
      New
      Next
      Not
      Off
      On
      Open
      Or
      Paint
      Peek
      Pen
      Pi
      Play
      Pointer
      Poke
      Pos
      Pot
      Print
      Print num
      Pudef
      Quit
      Rclr
      Rdot
      Read
      Record
      Rem
      Rename
      Renumber
      Restore
      Resume
      Return
      Rgr
      Right
      Rlum
      Rnd
      Rreg
      Rspcolor
      Rsppos
      Rsprite
      Run
      Rwindow
      Save
      Scale
      Scnclr
      Scratch
      Sgn
      Sin
      Sleep
      Slow
      Sound
      Spc
      Sprcolor
      Sprdef
      Sprite
      Sprsav
      Sqr
      Sshape
      St
      Stash
      Step
      Stop
      Str
      Swap
      Sys
      Tab
      Tan
      Tempo
      Then
      Ti
      Ti string
      To
      Trap
      Troff
      Tron
      Until
      Using
      Usr
      Val
      Verify
      Vol
      Wait
      While
      Width
      Window
      Xor
    Syntax
    Tokens
  C128
  D64plus
  Disk
  Escape Codes
  Hardware
  PCxface
  PETSCII
  Pet2asc
Futurama
IBM PC-AT
Contact
Games
Glossary
Hall of fame
Hall of shame
Miscellaneous
Privacy policy
Programming
Twisty puzzles
KeywordAbbreviationToken (hex)Version(s)Classification
TRONTR{Shift+O}D83.5, 7.0Command and Statement
RENAMERE{Shift+N} D8 4.x Command and Statement 

 Syntax 
TRON
 
 Purpose 
Debugging; enable program tracing.

 
 Remarks 
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:
10 IF 1 THEN PRINT "TRUE" : ELSE PRINT "FALSE"
TRON : RUN
[10][10]TRUE          first is for IF, nothing for THEN, second is for PRINT
[10]                  this is for ELSE (acts like REM)

READY.
10 IF 0 THEN PRINT "TRUE" : ELSE PRINT "FALSE"
RUN
[10][10]FALSE         first is for IF, nothing for THEN/ELSE, second is for PRINT

READY.
10 IF 1 THEN 20 : ELSE PRINT"FALSE"
20 END
RUN
[10][20]              [10] is for IF, nothing for implied GOTO
                      the ELSE was skipped by GOTO, [20] is for END

READY.
 
 Compare With 
 
 Contrast With 
 
 See Also 
AUTO, CMDELELSEHELPIF, THEN

© H2Obsession, 2014