Advent of Commodore 64

I’m such a fan of Advent of Code: daily coding puzzles every December. Last year I wrote about using it to learn TypeScript and Go, and reflected:

Using Advent of Code to learn these is lots of fun, but I’ll be honest — having a look at some of these more unusual ideas makes me tempted to try something more ambitious! Maybe I’ll look to overcomplicate things more next year.

— Me, November 2025

I’ve just bought a replica Commodore 64 — the computer that introduced me to programming — and I’m going to try solving this year’s puzzles with it. I’ll be happy if I solve just one before giving up and heading back to the modern computers and languages I’m more used to.

A Commodore 64 (grey boxy keyboard with a rainbow stripe logo at the top), a very old fashioned joystick, and a monitor showing a "hello world" program on a classic C64 screen.

Programming, a personal history

My dad tells me our first computer was a Commodore VIC-20, bought when I was a toddler. I don’t really remember that one but a few years later he bought us a Commodore 64, which I remember vividly — both the fun games we waited patiently to load (we only had a tape deck, no floppy disk or hard drive for us) and that tempting READY prompt inviting you to start typing code as soon as the computer turned on.

Usborne books and computer magazines gave me plenty of things to try out. Just a few years ago we found a “Mystery of Silver Mountain” book in my parents’ loft, with a school library due date slip on the front page saying it was due back in October 1988. It’s got so many pages of code you need to type in to play the game. 9-year-old me must have wanted to hang onto it until I’d typed in the whole thing, I hope I don’t get in trouble for it being so overdue.

Mystery of Silver Mountain book cover: a spooky wilderness and mountain scene with a path leading up. It says you get a story, clues and hints, and complete listing for the computer game.
A page from the book, telling you to type in the code. There's screeds of text, with little troll characters around it pointing out mistakes you might make or places to check whether your particular type of computer needs a line to change.

Learning the basics of programming with Commodore BASIC was such a useful first step for me, helping me get some “this is what programming is” fundamentals that gave me confidence to try other languages.

Back to basics

BASIC (Beginner’s All-purpose Symbolic Instruction Code) was created in 1964 at Dartmouth College, at a time when most people had never even seen a computer. Professors John Kemeny and Thomas Kurtz developed the language and a computer time-sharing system so they could encourage all staff and students, of all subjects, to learn what computers could do for them. Time magazine has the whole story: Fifty Years of BASIC, the Programming Language That Made Computers Personal.

Our vision was that every student on campus should have access to a computer, and any faculty member should be able to use a computer in the classroom whenever appropriate. It was as simple as that.

— John Kemeny, in a 1991 video interview linked from the Time article.

BASIC caught on outside of Dartmouth; a famous next step was when a 19-year-old Bill Gates teamed up with his friend Paul Allen to found “Micro-soft” to start porting BASIC to different computers. When they met with Commodore, they suggested $3 per machine sold with their BASIC on it, but instead agreed to Commodore’s offer of a one-off $25,000 payment for unlimited use. Every Commodore 64 sold had this Microsoft-written BASIC on it, even as the C64 went on to win a Guinness World Record for best-selling computer ever (a record it still holds).

Want to give it a try? This Lost Ways of Programming interactive tutorial lets you easily get a feel for what it’s like (some syntax isn’t identical to the original, as I found when I tried to follow along on my new C64 machine, but the author explains why “close enough” was what he went for).

Screenshot of the linked tutorial. Instructions on the left explain the approach - read along and try it out as you go - and on the right there's a realistic Commodore 64 welcome screen ready for you to type into.
From HELLO WORLD to bouncing a ball across the screen in your first 3 steps

There’s lots of good resources online; this tutorial walks through logistics of saving, typing and special keys as well as teaching you to make a text-based game. You can also refer to the classics, like the original user’s guide that came with every C64 and jumps straight into programming within a few pages. Good for spotting all kinds of gotchas that might catch me out when solving a Christmas-themed coding puzzle.

Excerpt from the manual, explaining how numbers get rounded when printed out - you'll only see up to 9 digits.

I’ve also treated myself to an original Programmer’s Reference Guide I found on eBay, for that authentic ring-bound experience.

Picture of the guide; cover looks very 1980s, with gridlines and line graph markings behind a floating computer.

If you’d like to try some C64 programming yourself, you could use:

I was tempted by that last one, but it’s a fair bit more expensive … and crucially, looks like the next time they’re shipping is February, too late for my Advent challenge. Let’s see if I feel the need for one after trying out this simpler version.

Know your limits

I’ve completed each Advent of Code for the last few years but I’m very sceptical about being able to do the whole thing on a C64.

What makes it so tricky? One hint comes right on the C64’s welcome screen: 38911 BASIC BYTES FREE. The Commodore’s 64K of RAM was an impressive amount in its day (just 13 years before this machine came out, the computer used in the moon landings had only 4K RAM). But look, before you’ve even written any code a huge chunk of that is gone. How much program code, and data to process, needs to be in RAM for some of these puzzles?

Other things on my mind:

  • According to the manual, I can enable REU (RAM Expansion Units), up to 16MB! But I’ll need to read up on how to let my programs take advantage of that.
  • The VICE emulator my machine runs on has a “Warp” mode that might triple the CPU speed (from its current 1MHz), not sure yet how well that might work.
  • Commodore BASIC runs as an interpreted language (meaning execution is slow and reading things like REM comment lines add to your runtime). A compiler can make a huge difference.
  • If you really want to get the most out of the hardware, leaving BASIC and moving to assembly language is the way to go … but I’m very daunted by that idea!

And of course … I’m very used to all sorts of “quality of life” language features that I’ll be missing:

  • You can use descriptive variable names if you like, but only the first two characters in a name are significant … and they’re all global variables.
  • You can declare functions (but only one line long, and one parameter), and subroutines (no name and no parameters).
  • We’ll be hitting all kinds of language limits (max string length is 255, max integer is 32767, and it uses 40 bit floats that are very different from the IEEE floats all modern languages use).
  • You do get arrays … but no dictionaries, record types, or the kind of extensive standard library I’ve been spoiled with for decades.

Last year I even felt limited by the very modern Go language in one puzzle and reached for Python libraries rather than roll my own linear optimisation code (see “I get along without you very well (except sometimes)”).

Kylo Ren in Star Wars, with his line "I know what I have to do but I don't  know if I have the strength to do it". Strength has been clumsily replaced by "linear optimisation library" in a different font.
Why yes I am very skilled at putting hilarious memes together, thanks for noticing.

Watch out for distractions

The main thing that might hold me back from becoming a C64 programming expert this December is … almost every game I loved as a youngster and haven’t seen in decades is now available online, to put on a USB stick and start playing on this C64 keyboard and joystick.

I was so impressed as a kid when the intro to this Ghostbusters game started playing the actual movie theme.

A blocky little forklift with instructions on how to move it around and load equipment into a blocky big car. There's a PK energy detector for $400, image intensifier for $800, and marshmallow sensor for $800.
Downloaded the .g64 game file from the Internet Archive, worked out why the joystick wasn’t working (you need to add _j1 to the filename to tell it the joystick’s in port 1), and started saving the city.

There’s piles of games I’m remembering (with the help of my brothers). Dizzy, Paperboy, Star Wars, California Games, International Karate Plus… have a look at c64.com for a huge range.

Photo of the C64 and monitor, with Skool Daze game intro showing a schoolkid drawing on a blackboard as a teacher walks in.


Posted

in

by

Comments

2 responses to “Advent of Commodore 64”

  1. RogerBW Avatar

    I’ll be interested to see how you go! My experience of AoC (and Everybody Codes) puzzles is that sufficiently clever programming can get round hardware and language speed limitations (I did 2022 entirely in PostScript), and sometimes even memory limits. But it’s very handy to be able to hop up to 64-bit integers when a part 2 gives you bigger numbers to work with, rather than hoping that CBM BASIC’s 5-byte floats will keep enough precision…

    1. Neil Vass Avatar
      Neil Vass

      PostScript! Wow that’s impressive. Thanks for the encouragement:)

Leave a Reply

Your email address will not be published. Required fields are marked *