Skip to content

Programming by Design

If you're not prepared to be wrong, you'll never come up with anything original. – Sir Ken Robinson

  • About
  • Java-PbD
  • C-PbD
  • ASM-PbD
  • Algorithms
  • Other

Commodore 64

Posted on September 13, 2023April 21, 2024 By William Jojo
C64

(Updated April 21, 2024)

Table of contents

Overview
Emulation
Operation
Test Drive
VICE


Overview

The Commodore 64 was notably the best-selling computer in history. It was inexpensive, easy to use, and had a following larger than any other platform from that period.

Using the MOS-6510 (a descendant of the VIC-20’s MOS-6502), anyone familiar with the 6502 instruction set could immediately program on this platform. They would only need additional documentation on the details of the remaining hardware.

Historical Note:
The MOS-6502 was the CPU in the Apple II, Commodore VIC-20, Atari 800 (personal computer) and 2600 (game console), and the Nintendo Entertainment System.

Emulation

There are many C-64 emulators available. Several run in a browser using Javascript. These are particularly powerful and feature-complete since they completely emulate all of the hardware initially in the C-64. You can try out the one used in this course which is a git clone of nippur72’s work. That work is based on the chip emulation work of floooh on GitHub.

It’s important to note that this is emulation and not simulation. Simulation implies that a best effort has been made to demonstrate how the original would have behaved. With emulation, every bit of the original work is brought into the software. In addition, every effort has been made to provide the original look and feel down to the operational speed. Since today’s computers run in the 2- to 3-GHz range and the 6510 was 1-MHz, there are 3 orders of magnitude from the original operating speed.

Operation

The C-64 was a simple console: keyboard, monitor (often a TV), and sometimes an I/O device like a datasette (cassette deck for data storage) or diskette drive.

The computer operator worked on a screen that allowed primitive commands to be entered or to write a program in the BASIC language. That’s it out of the box. A sample basic program is shown below.

10 FOR X = 1 TO 10
20 PRINT X
30 NEXT X

Line numbers distinguish the BASIC program from the system’s primitive command set.

Test Drive

Launch the emulator. After you do, you can try writing a program, or you can try some of the ones provided below. Remember that this is a primitive system. It’s nothing like Mac or Windows and was never meant to be.

Save any of the following to your computer. You can then drag one onto the C-64 emulator screen. The action is interpreted as loading a program and it attempts to run it. BASIC programs will run immediately. If it’s an assembly language program, you must use the SYS command to launch the program.

BASIC

Operational Note
All BASIC programs will automatically run.
Press the ESC to stop a running program.
Type LIST to see the code.

Oregon Trail (Text-based)
Kaleidoscope
Matrix Rain
Color Matrix Rain
Snake (W, A, S, D for movement.)

The source code for the BASIC programs can be found here.


Assembly Language

Operational Note
Since these are written in assembly language, you have to run the SYS command alongside the link to run the program.

Micromon (SYS 36864)
mult.prg (SYS 20480)
sum2.prg (SYS 16384)

Games

Pacman (RUN, then use the arrow keys.)
Mario Bros (RUN, then use the arrow keys.)
Spy Hunter (RUN, then use the arrow keys.)

The source code for the BASIC and assembly programs (except Micromon) can be found here.

Post navigation

❮ Previous Post: The Hex Dump
Next Post: Comparative Languages ❯

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2018 – 2025 Programming by Design.