in BASIC ROM:
|List of all BASIC keywords|
Type: Command General Programming-Syntax: LIST [[First Line]-[Last Line]]
The BASIC command LIST displays the BASIC program currently in memory: By default this listing is sent to the screen, but it can also be sent to e.g. a printer. Since program memory and the LISTing of its content is also used to retrieve and display the directory of a disk, LIST is also used to display such directories.
When LIST is used without any line numbers the entire program is listed. During listing of a long program, the user may cancel the listing immediately by pressing <RUN/STOP>, or slow down the scrolling speed (e.g. to allow reading) by holding down the <CTRL> key.
LIST is mainly used in direct mode, but may also be used as part of a BASIC program to make the program output a "dump" of itself during run-time. But due to the special internal handling of the LIST command inside the BASIC ROM, the program always terminates (as if there was an END command) after executing the LIST command, leaving the user with the "READY." prompt and cursor. This behavior changed with BASIC 3.5 and successive versions. Even though LIST may contain line numbers in its parameter list they won't be corrected if a program is renumbered using RENUMBER.
Examples[edit | edit source]
LIST 10 Only line 10 of this program is listed. LIST -10 All lines until line 10 of this program are listed. LIST 10- All lines beginning with line 10 of this program are listed. LIST 10-100 All lines beginning with line 10 and ending with line 100 are listed.
ROM details[edit | edit source]
LIST is handled by ROM at 42652–42817/$A69C–A741: The part of this routine that prints out characters and tokens from the BASIC program text, is vectored through address 774–775/$306–$307. Part of creating BASIC extensions involves re-directing this and other vectors to "new" routines to facilitate the extra BASIC keywords.