ASC

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: ASC
Abbreviation: A, Shift+S
Type: Function
Token code: 198/$C6
Handling routine
in BASIC ROM:
46987–47002
$B78B–B79A
List of all BASIC keywords


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

Type: Numerical Function 
General Programming-Syntax: ASC(<String>)

The ASC keyword evaluates the first char of a string as a numeric index, between 0 and 192, into the Commodore ASCII-table. To convert a numeric index, between 0 and 255 into the associated character, use the CHR$ keyword.

Evaluation of an empty string ("") results in the BASIC-error ?ILLEGAL QUANTITY ERROR. If no operand is provided, the BASIC-error ?SYNTAX ERROR results.

Examples[edit]

PRINT ASC("A")
 65

READY. PRINT ASC("ABC") 65
READY. PRINT ASC("")
?ILLEGAL QUANTITY ERROR READY. PRINT ASC
?SYNTAX ERROR READY. PRINT ASC(1)
?TYPE MISMATCH ERROR READY.
BASIC V2.0 (second release) Commands

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