Commodore‎ > ‎BASIC‎ > ‎Keywords‎ > ‎

HELP

Keyword Abbreviation Token (hex) Version(s) Classification
HELP HE{Shift+L} EA 3.5, 7.0 Command 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
Comments