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 | edit source]

BASIC 2.0[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[edit | edit source]

BASIC 3.5 defines 50 new keywords. Most have abbreviations.

AUTO aU
BACKUP bA
BOX bO
CHAR chA
CIRCLE cI
COLLECT colL
COLOR coL
COPY coP
DEC none
DELETE deL
DIRECTORY diR
DLOAD dL
DO none
DRAW dR
DSAVE dS
ELSE eL
ERR$ eR
EXIT exI
GRAPHIC gR
GSHAPE gS
HEADER heA
HELP heL
HEX$ hE
INSTR inS
JOY jO
KEY kE
LOCATE loC
LOOP loO
MONITOR mO
PAINT pA
PUDEF pU
RCLR rC
RDOT rD
RENAME reN
RENUMBER renU
RESUME resU
RGR rG
RLUM rL
SCALE scA
SCNCLR sC
SCRATCH scR
SOUND sO
SSHAPE sS
TRAP tR
TROFF troF
TRON trO
UNTIL uN
USING usI
VOL vO
WHILE wH

BASIC 4.0[edit | edit source]

BASIC 4.0 defines fifteen new keywords. Each has an abbreviation.

Keyword Abbreviation
APPEND aP
BACKUP baC
CATALOG cA
COLLECT coL
CONCAT conC
COPY coP
DCLOSE dC
DIRECTORY diR
DLOAD dL
DOPEN dO
DSAVE dS
HEADER hE
RECORD reC
RENAME rE
SCRATCH sC

BASIC 7.0[edit | edit source]

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:

Keyword Abbreviation 2.0 abbreviation gives
CONT coN CONCAT
END none ENVELOPE
PEEK peE PEN
POKE poK POT
READ reA RECORD
SPC( spC SPRITE
STOP stO STASH

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.

Keyword Abbreviation 3.5 abbreviation gives
BACKUP baC BANK
BOX none BOOT
COLLECT collE COLLISION
COLOR colO COLLISION
MONITOR moN MOVSPR

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.

Keyword Abbreviation 4.0 abbreviation gives
COLLECT collE COLLISION
CONCAT cO CONCAT
HEADER heA HEX$
RECORD rE RECORD
RENAME reN RENAME
SCRATCH scR SCNCLR

These are the new BASIC 7.0 keywords with their abbreviations:

APPEND aP
AUTO aU
BACKUP baC
BANK bA
BEGIN bE
BEND beN
BLOAD bL
BOOT bO
BOX none
BSAVE bS
BUMP bU
CATALOG cA
CHAR chA
CIRCLE cI
COLLECT collE
COLLISION coL
COLOR colO
CONCAT cO
COPY coP
DCLEAR dclE
DCLOSE dC
DEC none
DELETE deL
DIRECTORY diR
DLOAD dL
DO none
DOPEN dO
DRAW dR
DSAVE dS
DVERIFY dV
ELSE eL
ENVELOPE eN
ERR$ eR
EXIT exI
FAST fA
FETCH fE
FILTER fI
GRAPHIC gR
GSHAPE gS
HEADER heA
HELP heL
HEX$ hE
INSTR inS
JOY jO
KEY kE
LOCATE loC
LOOP loO
MONITOR moN
MOVSPR mO
OFF oF
PAINT pA
PEN pE
PLAY pL
POINTER poI
POT pO
PUDEF pU
QUIT qU
RCLR rC
RDOT rD
RECORD rE
RENAME reN
RENUMBER renU
RESUME resU
RGR rG
RREG rR
RSPCOLOR rspC
RSPPOS rS
RSPRITE rspR
RWINDOW rW
SCALE scA
SCNCLR sC
SCRATCH scR
SLEEP sL
SLOW sL
SOUND sO
SPRCOLOR sprC
SPRDEF sprD
SPRITE sP
SPRSAV sprS
SSHAPE sS
STASH sT
SWAP sW
TEMPO tE
TRAP tR
TROFF troF
TRON trO
UNTIL uN
USING usI
VOL vO
WHILE wH
WIDTH wiD
WINDOW wI
XOR xO