Home
CBM
  ASCII-X
  BASIC
    Disk Commands
    Enter RUN mode
    Program Format
    Secret Variables
    Variable Format
    Expressions
    Keywords
    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
The CBM BASIC Interperter operates in one of two modes.  "Direct Mode" is the default.  This allows the user to freely navigate the screen with the cursor keys and to enter commands or programs lines.  Commands are executed immediately when the user presses Enter/Return key, and program lines are entered (or deleted) when the user presses the Enter/Return key as well.
 
That is, until the user enters a command that switches the the BASIC Interpreter into "RUN Mode" or program execution mode.
 
The following commands can switch the interperter into RUN Mode:
The listed commands will not always cause RUN Mode to be entered.  Generally this only happens (or rather fails to happen) when an error occurs.
 
When RUN Mode is entered, the following occurs:
  • AUTO line-numbering is disabled
  • Auto-Insert mode is disabled
  • the "inside COLLISION flag" is cleared
  • pending COLLISIONs are cleared
  • KERNAL "error" messages are disabled (PRESS PLAY ON TAPE, etc.)
  • The text cursor is invisible (until INPUT is invoked)
Not much too it, but it can be difficult to tell what is happening when RUN and/or CLR is issued.  Those commands/statements invoke additional tasks.
 
As far as I know, this has never been documented.  But it is not hard to find from a disassembly of the ROMs.
 
The following commands may fail to switch the interpreter into RUN Mode:
If a program has halted (due to execution of END or STOP keywords, or the user pressed the STOP key), then there may be pending DO / FOR / GOSUB entries on the BASIC stack.  Entering one of the corresponding commands from the above list will try to resume execution at the appropriate location in the program, however when BASIC fails to enter RUN mode, strange things happen.  Once in C64 mode I got an infinite number of errors referring to a non-existant line 0 (can't replicate it now; in fact NEXT and RETURN seem fine on the C64 now).  But there is clearly a bug in the C128 where it just says READY... like it never even tries.  Anyway, the results are unreliable / machine-specific.
 

© H2Obsession, 2014