C64 BASIC 2025: Lesson 1 – Retro Programming for Beginners in English

A complete guide to C64 BASIC programming in 2025. Learn the basics of Commodore 64 programming, including emulators, direct and program modes, variables, and essential commands like PRINT, LIST, RUN, SAVE, LOAD, and VERIFY. Ideal for users in the UK, US, and Canada interested in retro computing and programming basics.

Lesson 1 – A Little School of Retro Programming in Standard C64 BASIC

Let’s learn about emulators and C64 BASIC programming – LESSON ONE.

Getting Started with Programming

Let’s embark on a journey through retro waters (direct and programmatic modes plus basic commands like PRINT, LOAD, SAVE, etc.).

Welcome to “A Little School of Commodore 64 BASIC Programming” – a guide that takes you through the fundamentals of C64 BASIC programming on the legendary machine that defined the 1980s era. Throughout this guide, we’ll get acquainted with basic BASIC commands, writing your first programs, and creating simple applications to use the C64 as a programming tool. Ready? Power on your Commodore 64 or launch your favorite C64 emulator and dive into the world of retro coding!

As mentioned, we will be using the CCS64 emulator for our work and adapting the lessons accordingly. Of course, you can easily follow the lessons on a real C64 or any other emulator like VICE (Versatile Commodore Emulator), a popular choice among retro computing enthusiasts in the UK and US. For users in the UK, emulators are generally considered legal for personal use, especially if you own the original software. In the US, the Fair Use doctrine often applies to hobbyist retro kits and emulation for preservation purposes. Canadian users can explore digital heritage initiatives supported by Library and Archives Canada.

First, we’ll create a blank .d64 file (a virtual floppy disk). By pressing F10, we’ll select 1541 device 8. Then F2 and navigate to create empty .d64. We’ll name it lessons.d64 and by pressing ENTER, we’ll have our desired file. We will save everything we do in it. Of course, since this file simulates the size of a floppy disk, it cannot be filled indefinitely with data, but for our needs, it will be more than sufficient, and we can always format a new virtual floppy disk.

Introduction to BASIC on Commodore 64

BASIC, or “Beginner’s All-purpose Symbolic Instruction Code,” was the primary programming language on the C64 and many other home computers. It allowed users to write simple programs using English-like commands.

Direct and Programmatic Command Execution

If you want to see the result of a command immediately, you type it along with its arguments and then press the RETURN key (or ENTER in the emulator). The result will instantly appear on the screen. Now comes the main part. To create a program in standard C64 BASIC (as well as in BASIC versions on most other computers) that will be executed later, we assign program line numbers (10, 20, 30…) to the same commands. You might ask why we don’t start with line numbers 1, 2, 3… The answer is simple. When you want to insert commands between two already entered program lines, you can insert a number in between and enter the desired commands. For example, line 15 will naturally appear between lines 10 and 20, which is extremely useful and very often applied during program creation. Also, pay attention to the blinking square. That’s the C64 cursor, indicating where the character you type will appear.

Variables

Before starting C64 BASIC programming, we need to learn about a very important computer capability that allows most of our programs to function. What are variables? Variables can be imagined as boxes within the computer that contain numbers or text. We can then work with these boxes: for numerical data, we can perform various calculations, evaluate desired functions, etc.; and for textual data, we can concatenate, add, subtract, search, and much more. Numerical variables are denoted by letters or words, and their value is assigned via commands or simply by the = sign (e.g., R=5 or RESULT=5). Textual variables are also denoted by letters or words, but they are suffixed with a $ sign. Their value is also assigned via commands or the = sign, and they are enclosed in quotation marks (e.g., I="Miki" or NAME$="Miki").

Essential BASIC Commands

PRINT – The First Command

  • PRINT "Hello C64!" – Displays the text “Hello C64!” on the screen without quotation marks.
  • PRINT 5+7 – Displays the result 12 on the screen.
  • PRINT R – Displays the numerical value of variable R on the screen (in our example, 5).
  • PRINT NAME$ – Displays the textual value of variable NAME$ on the screen (in our example, “Miki”).

The PRINT command is used to display text or variable values, as well as for direct and programmatic calculations. This command also has the capability to display the results of various functions. It is used with minor variations when working with printers, disks, databases, etc.

If we want to use it in a program, we’ll assign a program line number and thus begin programming:

10 PRINT "Hello C64!"

Pressing ENTER will do nothing, as the command we wrote will be stored in the computer’s memory, waiting to be started, listed, or deleted.

LIST – Listing a Program

This command displays what we have entered as a program. The formats of this command are:

  • LIST – Lists the entire program in memory.
  • LIST 10 – Lists only the program line with this number (or any number we put that exists in the program).
  • LIST -50 – Lists program lines from the beginning of the program up to number 50.
  • LIST 30-70 – Lists program lines from number 30 to 70.
  • LIST 80- – Lists program lines from number 80 to the end of the program.

RUN – Starting a Program

This command is very important as it serves to start a program from memory. Of course, program execution proceeds sequentially unless a command redirects the program flow to another program line. The formats of this command are:

  • RUN – Starts the program from the first program line entered into memory.
  • RUN 50 – Starts the program from program line 50 (of course, you determine which line number you want to be the starting point).

GOTO – Go to the Desired Program Line

We use this command when we want the program, instead of executing sequentially, to jump to a specific program line. The format of this command is:

  • GOTO 10 – Go to program line 10 (or any other as desired).

Now we can create a small program using this command and the one we just learned:

10 PRINT "Hello C64!"
20 GOTO 10


When we type the RUN command and press the RETURN key (or ENTER in the emulator), the program will start executing. In the first program line 10, the text “Hello C64!” will be displayed on the screen, and the cursor/text output will move to the next screen line. The second program line will return the program counter to the first line, so this text will be displayed again, and so on indefinitely. To stop the execution of this program, we need to press the “RUN/STOP” key (which is the “ESC” key in the emulator).

If we want the text to be displayed without moving to the next line on the screen, we add a semicolon (;) at the end of the first program line, so now this line looks like this: 10 PRINT "Hello C64!";. If we want a specific spacing during output, we use a comma (,) – 10 PRINT "Hello C64!",.

To add something to a program line, we can type the entire line with changes and press RETURN/ENTER, or, much easier, list the program if the desired line is not visible on the screen, use the arrow keys to move the cursor to the desired spot, add what we want, and then press RETURN/ENTER. If we want to delete an entire program line, we just enter its number and press RETURN/ENTER.

SAVE – Saving a Program

This command saves our program to a cassette recorder or floppy disk. Its basic form is:

  • SAVE "PROGRAM NAME",1 – for cassette recorder (here, the ‘1’ indicates a cassette recorder and is implied, so it’s not necessary to type it).
  • SAVE "PROGRAM NAME",8,1 – for floppy disk (the ‘8’ indicates the primary disk drive and must be typed, and the ‘1’ indicates that the saving is done exactly according to the memory map / for saving BASIC programs, it can be omitted, but I recommend typing it anyway).

Since we already have a program from earlier, we’ll save it to a floppy disk (or in the emulator’s file) as follows:

SAVE "LESSON-1",8,1

In the emulator, after that, we’ll press F10, select 1541 device 8, and press ENTER again. (By the way, the numbers next to 1541 device from 8 to 11 indicate the disk drives that could be connected to the C64. The primary/main disk drive is number 8, and other additional ones are from 9-11). The computer will ask if you want to write the changes to the virtual floppy disk, to which you will answer YES. You can perform multiple saves before this.

NEW – Deleting a Program

This command deletes the program from memory. Enter this command directly (at this point, I won’t bother you anymore with pressing RETURN/ENTER because you now know that after every command, for it to be executed or for a program line to be entered into the computer’s memory, you must do this). When you use the LIST command, you will see that the program is no longer there.

LOAD – Loading a Program

This command loads the desired program from a cassette recorder or floppy disk. Its basic form is:

  • LOAD "PROGRAM NAME",1 – for cassette recorder (as with the SAVE command, here ‘1’ indicates a cassette recorder and is implied, so it’s not necessary to type it).
  • LOAD "PROGRAM NAME",8,1 – for floppy disk (as with the SAVE command, ‘8’ indicates the primary disk drive and must be typed, and ‘1’ indicates that the loading is done exactly according to the memory map / for loading BASIC programs, it can be omitted, but I recommend typing it anyway).

Since we just saved our program and then deleted it, we will load it back into memory as follows:

LOAD "LESSON-1",8,1

Also, if this is the only program on the disk, we can type:

LOAD "*",8,1

where the first program from the disk will be loaded. This "*" wildcard can also be combined when there are multiple programs on the disk. Then it’s easiest to type the command, enter three or four initial characters of the program name, and add "*" (e.g., LOAD "LESS*",8,1).

VERIFY – Verifying Program Write Integrity

This command checks whether the desired program has been correctly saved to the cassette or floppy disk. Its form is:

VERIFY "LESSON-1",8,1

If everything is in order, the message “READY” will appear. If not, a “VERIFY ERROR” message will pop up.

And so, the first lesson comes to an end. There are many more options and nuances, but for now, this is quite enough. Finally, keep this in mind: what distinguishes a good program from an excellent one is the willingness to learn and experiment. Don’t be satisfied with just what you learn through courses, websites, magazines, or any other means. Always look for what can be added, subtracted, improved, or corrected, how that program would look if you had created it from scratch, etc., etc., etc. In a word, be persistent, curious, and always strive for a better and more functional program.

💾 Ready to Code?

<p>Open your emulator, create your first .d64 disk, and start typing! Don’t forget to save and verify.</p>

📚 Useful Links and Resources