LIST
From C64-Wiki
| BASIC keyword | |
| Keyword: | LIST |
| Abbreviation: | L Shift+I |
| Type: | Command |
| Token code: | 155/$9B |
| Handling routine in BASIC ROM: | 42652–42774 $A69C–A716 |
| List of all BASIC keywords | |
Remark: This article describes the BASIC-Command LIST in BASIC V2 at the Commodore 64.
Typ: 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 it's content is also used to retrieve and display the directory of a disk, LIST is also used to display such directories.
When LIST is using without any linenumbers, the entire program is be listing. 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.
By default, LIST displays its output on the screen, but the BASIC-Command CMD may be used to re-direct the listing to a printer, a file on a disk drive, or other peripheral devices through the use of the CMD command.
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 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.
[edit] Examples
LIST 10 Only the line 10 of this programm is listing on screen. LIST -10 All lines until line 10 of this programm are listing on screen. LIST 10- All lines beginning with line 10 of this programm are listing on screen. LIST 10-100 All lines beginning with line 10 and ending with line 100 are listing.
[edit] ROM details
LIST is handled by ROM at 42562–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.
ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC( | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB( | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT