DATA

From C64-Wiki

Jump to: navigation, search
BASIC keyword
Keyword:DATA
Abbreviation:D, Shift+A
Type:Command
Token code:131/$83
Handling routine
in BASIC ROM:
43256–43269
$A8F8–A905
List of all BASIC keywords


Remark: This article describes the BASIC-Command DATA in BASIC V2 at the Commodore 64.

Typ: Command
General Programming-Syntax: DATA <constant> [,<constant>]

The BASIC-Command DATA is used to store constant information in the program code, and is used with the BASIC-command READ. Each DATA-line can contain 1 or more constants separated by commas. Expressions containing variables etc. will not be evaluated here.

The information in DATA-lines will be read from left to right, beginning with the first DATA-line each time a READ instruction is executed. Chars can be written normally or in quotes, but chars like comma, space, colon, graphic chars or control characters must be written inside quotes as a string. The BASIC-command RESTORE resets the pointer of the next DATA-constant so that next READ will read from the first constant of the first DATA-line.

If READ is used with the wrong type of variable, the BASIC-error ?SYNTAX ERROR IN line occurs with a reference to the corresponding DATA-line.

[edit] Examples

10 DATA 1, 2, 3, Apple, "Commodore 64" 
20 DATA "This ; is : a # test , or ? "
30 READ A, B%, C1, D$ 
40 READ E$, F$  
50 PRINT A, B%, C, D$, E$ : PRINT F$
BASIC V2.0-Commands of Commodore 64

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

 
Personal tools
Help and Feedback
In other languages