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

AUTO

Keyword Abbreviation Token (hex) Version(s) Classification
AUTO A{Shift+U} DC 3.5, 7.0 Command
BANK B{Shift+A}  DC  4.7  Command and Statement 

  Syntax  
AUTO increment ]
 
Parameters Type Legal Value(s) Default Value Note(s)
increment Unsigned Integer 0 ~ 63999 Should be a literal number; really anything except a number of 64000 or more.
 
 
  Purpose  
Program editing utility; Automatically print a new line number after entering a program line.

 
  Remarks  
AUTO allows you to more easily enter a program by automatically type the next line number in sequence.  This assumes the line numbers you are entering ascend by the value increment (with 10 being a common value).
 
The AUTO command simply stores a value in a secret variable.  Assuming increment is a literal number, it is converted to an integer with INT, and if the result is 64000 or more then SYNTAX ERROR is generated.  If the value is less than 0, or if increment is not a literal number, or if increment is omitted, then zero is stored in the secret variable.  Otherwise (an increment from 0 to 63999) is stored.
 
Whenever you enter a program line (only possible in direct mode), BASIC will check the secret variable.  If it is not zero, then that value is added to the line number of the line just entered.  If the result is less than 64000 then on the next line of the text screen BASIC will print the calculated value followed by a cursor right.  Assuming there was nothing on the next line, then you are ready to enter your next program line.  If there was something on the next line, the you will need to press DELETE and SPACEBAR (or something similar) to erase the character that was skipped by the cursor right.  Why Commodore choose to print a cursor right after its numbers in BASIC, instead of a simple space like any sane person, is beyond me!
 
Attempting to use AUTO as a statement in a program causes DIRECT MODE ONLY ERROR.  Although it serves no real purpose since you can't enter program lines while a program is running, it is strange that it would cause an error.
 
The secret variable is set to zero on power-up, and whenever BASIC enters run mode.
 
Example:
AUTO 10

READY.
100 REM TEST LINE
110                  automatically printed; the BOX represents the cursor position
 
 
  Compare With  
 
  Contrast With  

 
  See Also  

© H2Obsession, 2014
Comments