READY.000 C64 Coding

How to Type In a Listing

AT A GLANCE

Letters
Type them without SHIFT
Each line
Line number, then the code, then RETURN
{CODES}
Keys pressed inside quotes; the legend under each listing says which
Save
SAVE"NAME",8 every few minutes
Stuck?
LIST the line from the error and compare it, character by character

In the 1980s, most software for the Commodore 64 arrived on paper. Books and magazines printed programs line by line, and you typed them in. It took an evening, the first RUN usually ended in ?SYNTAX ERROR, and it was the best way ever invented to learn BASIC. This guide covers everything you need to type in the listings on this site, on a real C64 or in an emulator.

Warm up

Start with five lines. Type each one exactly as shown and press RETURN at the end of every line. Click a line on the screen below once you have typed it, and the site keeps track for you.

Then type RUN and press RETURN. If the screen clears and counts to five in colour, you know everything below already.

The rules of the screen editor

Letters: no SHIFT

Listings on this site are written in lower case because that is how the C64 sees ordinary letters. On the machine they appear as capitals. Holding SHIFT gives you graphic symbols instead, which is almost never what a listing wants.

Line numbers

Every line starts with a number. The C64 stores lines in numerical order, whatever order you type them in, so you can come back for a missed line later.

  • Replace a line: type it again with the same number.
  • Delete a line: type only its number and press RETURN.
  • Fix a line: LIST 690, move the cursor up onto it, type over the mistake and press RETURN while the cursor is still on that line.

80 characters per line

A line you type can be at most 80 characters, two rows of the screen. Some listings have longer lines. They fit because BASIC keywords can be abbreviated: the first letter, then the second letter with SHIFT. P + SHIFT O is POKE, and ? on its own is PRINT. The abbreviation shows as a graphic symbol while you type and turns back into the full word when you LIST.

Typing the {CODES}

Many listings move the cursor or change colour inside a PRINT statement. On the C64 you do this by pressing the key itself while you are between quotes. The C64 is then in quote mode: instead of moving the cursor or changing the colour, it records the key as a reversed symbol in the line.

On this site those keys are shown as CLR-style chips, and coloured chips show the colour they select. Under every listing, How to type the {codes} lists exactly which key gives each one. The common ones:

CodeKeyDoes
{CLR}SHIFT + CLR/HOMEclears the screen
{HOME}CLR/HOMEcursor to the top left
{DOWN} / {UP}CRSR ⇕, with SHIFT for upcursor down / up
{RIGHT} / {LEFT}CRSR ⇔, with SHIFT for leftcursor right / left
{RVS ON} / {RVS OFF}CTRL + 9 / 0reverse text on / off
{WHT} {RED} {CYN} …CTRL + 1–8the first eight colours
{ORNG} {BRN} {LRED} …C= + 1–8the other eight colours

A number in front means “press it that many times”: 3 DOWN is CRSR ⇕ three times.

Quote mode lasts until you type the closing quote. If you press a cursor key by mistake inside quotes, it becomes part of the line. The easiest fix is to finish the line, press RETURN and type the whole line again.

Check what you typed

LIST            the whole program
LIST 500-600    lines 500 to 600
LIST -100       from the start to line 100
LIST 1000-      from line 1000 to the end

Hold CTRL to slow the listing down, or press RUN/STOP to stop it.

Save early, save often

A typo in a POKE can lock up the machine, and then everything you typed is gone. Save every few minutes:

SAVE"ZARIA",8      to disk (drive 8)
SAVE"ZARIA"        to tape
LOAD"ZARIA",8      load it back, then RUN
LOAD"$",8          load the disk directory, then LIST

Saving again under a name that is already on the disk does nothing: the drive light blinks (error 63, FILE EXISTS) and the screen just says READY. Number your saves instead, ZARIA1, ZARIA2 and so on, and you also keep a copy from before the last change.

When RUN goes wrong

The C64 tells you which line broke. ?SYNTAX ERROR IN 690 means: LIST 690 and compare it with the listing, character by character. The usual suspects:

TypedShould beTypical result
letter Ozero 0?SYNTAX ERROR, or a wrong number
letter I or lone 1?SYNTAX ERROR
;:?SYNTAX ERROR
, or .the other onewrong values, ?OUT OF DATA
AA$?TYPE MISMATCH
a missing quote"keywords inside the text, odd output

Other messages point somewhere else:

  • ?OUT OF DATA: a DATA line is missing, or a number in it is missing or has an extra comma.
  • ?UNDEF'D STATEMENT: a GOTO or GOSUB jumps to a line you have not typed yet.
  • ?BAD SUBSCRIPT: an array index is wrong. Check the DIM line and the line in the error.
  • ?NEXT WITHOUT FOR: a FOR line is missing or mistyped.

If a program runs away and will not stop, hold RUN/STOP and tap RESTORE. The screen resets, and your program is still in memory.

The shortcuts on this site

  • Tick off lines as you type them. The site remembers where you stopped, even if you close the page.
  • ↓ .PRG gives you the finished program. Load it next to yours to see whether the problem is in your typing or in the listing.
  • Aa switches the listing to a plain font if the pixel font is hard to read.
  • Found a mistake in a listing? Report it.

No C64 at hand? Run the programs in VICE, the free emulator used for every listing here.

Comments