BASIC keyword abbreviation

From C64-Wiki
Jump to navigationJump to search

Commodore BASIC offers a "shortcut" (known as BASIC keyword abbreviation) for entering keywords: Generally, a BASIC keyword may be entered as merely the first letter of the keyword in "lowercase", followed by the second one in "uppercase" (i.e. using one of the SHIFT keys). For instance:

  • The keyword SAVE can be entered as sA (a lowercase "S" and an uppercase "A")
  • The keyword VERIFY can be entered as vE (a lowercase "V" and an uppercase "E")

In some cases, two keywords begin with the same two letters; in these cases one takes "precedence", so the abbreviation for the consists of the first two letters in "lowercase", followed by the third in "uppercase":

  • The keyword GOTO can be entered as gO
  • The keyword GOSUB is abbreviated to goS

Because of the way these shortcuts are implemented in the code in BASIC ROM, there are several "shortcuts" for each keyword: GOSUB may be entered not only as "goS" (G, O, Shift+S), but also as "gosU" (G, O, S, Shift+U). But entering the whole word with the last letter capitalized: "gosuB" (G, O, S, U, Shift+B) fails, yielding some other, "random" BASIC keyword which will most likely yield a ?SYNTAX  ERROR.

One exception to the rule is PRINT, which is abbreviated to a question mark, so that

? "Hello world!"

is a valid PRINT statement . ("pR", or P, Shift+R is the abbreviation for PRINT#). A few BASIC keywords, such as NEW and INT do not have abbreviations at all.

Overview of BASIC abbreviations[edit]

The following table gives the shortest possible abbreviation for all keywords in the Commodore BASIC V2 found in the C-64:

ABS aB (A, Shift+B)
AND aN (A, Shift+N)
ASC aS (A, Shift+S)
ATN aT (A, Shift+T)
CHR$ cH (C, Shift+H)
CLOSE clO (C, L, Shift+O)
CLR cL (C, Shift+L)
CMD cM (C, Shift+M)
CONT cO (C, Shift+O)
COS (No abbreviation)
DATA dA (D, Shift+A)
DEF dE (D, Shift+E)
DIM dI (D, Shift+I)
END eN (E, Shift+N)
EXP eX (E, Shift+X)
FN (No abbreviation)
FOR fO (F, Shift+O)
FRE fR (F, Shift+R)
GET gE (G, Shift+E)
GET# (No abbreviation)
GOSUB goS (G, O, Shift+S)
GOTO gO (G, Shift+O)
IF (No abbreviation)
INPUT (No abbreviation)
INPUT# iN (I, Shift+N)
INT (No abbreviation)
LEFT$ leF (L, E, Shift+F)
LEN (No abbreviation)
LET lE (L, Shift+E)
LIST lI (L, Shift+I)
LOAD lO (L, Shift+O)
LOG (No abbreviation)
MID$ mI (M, Shift+I)
NEW (No abbreviation)
NEXT nE (N, Shift+E)
NOT nO (N, Shift+O)
ON (No abbreviation)
OPEN oP (O, Shift+P)
OR (No abbreviation)
PEEK pE (P, Shift+E)
POKE pO (P, Shift+O)
POS (No abbreviation)
PRINT# pR (P, Shift+R)
READ rE (R, Shift+E)
REM (No abbreviation)
RESTORE reS (R, E, Shift+S)
RETURN reT (R, E, Shift+T)
RIGHT$ rI (R, Shift+I)
RND rN (R, Shift+N)
RUN rU (R, Shift+U)
SAVE sA (S, Shift+A)
SGN sG (S, Shift+G)
SIN sI (S, Shift+I)
SPC( sP (S, Shift+P)
SQR sQ (S, Shift+Q)
STATUS (No abbreviation)
STEP stE (S, T, Shift+E)
STOP sT (S, Shift+T)
STR$ stR (S, T, Shift+R)
SYS sY (S, Shift+Y)
TAB( tA (T, Shift+A)
TAN (No abbreviation)
THEN tH (T, Shift+H)
USR uS (U, Shift+S)
VAL vA (V, Shift+A)
VERIFY vE (V, Shift+E)
WAIT wA (W, Shift+A)