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
AUTOA{Shift+U}DC3.5, 7.0Command
BANKB{Shift+A} DC 4.7 Command and Statement 

 Syntax 
AUTO increment ]
 
ParametersTypeLegal Value(s)Default ValueNote(s)
incrementUnsigned Integer0 ~ 63999Should 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