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 | edit source]
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 |
?
|
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)
|
TIME |
TI
|
TIME$ |
TI$
|
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)
|
|
BASIC 3.5 defines 50 new keywords. Most have abbreviations.
BASIC 4.0 defines fifteen new keywords. Each has an abbreviation.
Where an abbreviation could match two or more keywords, it is assigned to the keyword that the BASIC interpreter happens to scan first. BASIC 7.0 defines dozens of new keywords, and it scans the ones with two-byte token codes before the ones with one-byte codes, including the keywords in BASIC 2.0 and 3.5. Consequently, keywords in other BASICs have longer abbreviations in BASIC 7.0 than in the other version, or no abbreviation at all.
These are the BASIC 2.0 tokens with different abbreviations in BASIC 7.0:
All of the BASIC 3.5 keywords occur in BASIC 7.0, except for RLUM, and the token codes are the same. Five keywords have different abbreviations in BASIC 7.0 than in 3.5.
All of the BASIC 4.0 keywords occur in BASIC 7.0, but the token codes are different, and so is the scan order. Six keywords have different abbreviations in BASIC 7.0 than in 4.0. Three abbreviations are shorter, and the BASIC 4.0 abbreviation gives the same keyword.
These are the new BASIC 7.0 keywords with their abbreviations: