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
HELPHE{Shift+L}EA3.5, 7.0Command and Statement*

 Syntax 
HELP 
 
 Purpose 
Debugging.  Print the BASIC program line of the most recent error and highlight the erroneous statement.

 
 Remarks 
HELP will LIST the line of a program that generated the most recent error.  The specific statement within the line (and everything after) will be highlighted.  The form of highlighting varies by video chip.  For the TED, the characters will be flashing.  For the VDC, the characters will be underlined (even though the VDC allows flashing characters).  For the VIC-II, the characters will be in reverse-font.  Usually you can just use the cursor keys to make corrections in the line displayed by HELP and press return to update the program line.  But you should not do this when using the VIC-II.  This is because quoted characters (now reversed) will now act as control-codes instead of normal characters when the program is RUN.
 
If there is no previous error (EL is 65535) then HELP displays a blank line (i.e., just prints a carriage return).
 
The output from HELP is sent to the current output device, which is usually the (active) text screen.  You could redirect the output to another device (printer or disk file) and send the "help message" to that device, although I don't know why.
 
HELP is really handy, except that it highlights the entire statement that caused the last error.  Some statements and functions have numerous parameters and it would really be nice to know which parameter was at fault.  Oh well, I guess it is better than nothing!  On a related issue, the way BASIC takes a short-cut in processing THEN and ELSE means that if either of them has an error, then the entire IF/THEN/ELSE construct will be highlighted.  This can really make it hard to figure out where the error is located!
 
* Although HELP can be used as a statement in a program, it serves no purpose to the programmer since the line is only printed.  It may be useful inside an error-trap routine to display the error to the user (but unlikely).  For programming purposes, refer to the reserved variables EL and ER.  The only thing they don't tell you is the exact statement within a line where the error occured.  That information is contained in a secret variable "TRAP Address".
 
The (first) statement that is highlighted by HELP is the one that will be re-executed if a trap routine uses RESUME without any arguments.  The statement following the first highlighted colon (or the first statement on the next line if there is none) is the one that will be executed by RESUME NEXT.  This is probably not the right statement in the case of IF/THEN/ELSE.
 
If an error occurs in direct mode, the reserved variable EL will not be changed, but the reserved variable ER will.  This can result in strange results if try to continue the program with GOTO and your program relies on those reserved variables (note you can't use CONT after an error, and you can't use RESUME in direct mode).  The last error is fully cleared by CLR.  Several statements call CLR internally: DLOAD, LOAD, RUN.
 
If you attempt to supply an argument to HELP then SYNTAX ERROR occurs.
 
Examples:
NEW

READY.
10 PRINT "HELLO" : JUNK
RUN
HELLO
?SYNTAX ERROR IN 10

READY.
HELP
10 PRINT "HELLO" : JUNK

READY.
PRINT EL; ER
 10  11

READY.
X = "STRING"
?TYPE MISMATCH ERROR

READY.
HELP
10 PRINT "HELLO" : JUNK

READY.
PRINT EL; ER
 10  22

READY.
 
 
 Compare With 
DS, DS$, ERR$, LIST, ST
 
 See Also 
CLR, ELELSE, ERTHENTRAP, RESUME  

© H2Obsession, 2014