Do you remember the legendary Commodore 64 days?
That classic clacking keyboard, the floppy disks carefully inserted into the drive, the hours spent mastering assembly to create tiny pixel and sound marvels… Ah, those were the good old days!
Well, believe it or not, you can relive some of that magic in 2023 with modern tools and a powerful PC.
To achieve this, you’ll need a few basic ingredients:
- Visual Studio Code, the ultra-versatile code editor that adapts to all languages.
- The VICE emulator (what else?) to run your programs as if they were on a real C64.
- The Kick Assembler compiler to transpile your code into binary (you’ll need Java for this).
- Git to version your code like a pro.
Setting all this up can be a bit of a challenge, but don’t worry, everything is explained in this video that guides you step-by-step, even if you’re a beginner.
Start by installing Git, Java, and Visual Studio Code. This part is easy. Next, download Kick Assembler and VICE, which is where things get a bit tricky. But follow the instructions carefully, and in just a few minutes, you’ll have a fully operational development environment!
Visual Studio Code comes with extensions for a myriad of tasks, and of course, there is one for C64 assembly. Once installed, you’ll benefit from syntax highlighting, code completion, and even real-time debugging with VICE.
With Kick Assembler, you’ll be able to write your source code much more comfortably than before. No longer are you limited to 40 columns, and the editor will help prevent many typing mistakes. The best part is that you can use macros, constants, and even high-level instructions to make your life easier. Ultimately, Kick Assembler transpiles everything into good old 6502 assembly.
As for VICE, it’s simply the best C64 emulator available today. It’s highly faithful to the original hardware and offers a plethora of options to facilitate development: step execution, breakpoints, register and memory inspection, and more. It’s a joy for debugging your programs!
Here’s a simple Hello World example that displays a message on the screen and changes the border color:
;===============================================================================
; This is an example of an assembly program for the Commodore 64
; using the KickAssembler assembler.
;===============================================================================
; Constants for C64 colors
BLACK = 0
WHITE = 1
*= $0801
;===============================================================================
; The BASIC code at the beginning is used to launch our assembly program.
; Here we use the KickAssembler BasicUpstart2 macro which automatically generates
; the appropriate BASIC code.
;===============================================================================
BasicUpstart2(start)
;===============================================================================
; Our assembly program starts here
;===============================================================================
start:
; Change the border color to black
lda #BLACK
sta $d020
To compile, load, and run the program:
- Press F5 in VSCode to compile with KickAssembler.
- In VICE, use
LOAD "HELLO.PRG",8,1
to load the program, thenRUN
to execute it.
To compile this program, make sure you use Kick Assembler. You can compile it by pressing F5 in Visual Studio Code if you have configured Kick Assembler as the default assembler. Once compiled, you’ll get a PRG file that you can load into the VICE emulator using the following command: LOAD "HELLO.PRG",8,1
.
Then type RUN
to execute the program. You should see “HELLO WORLD!” on the screen, with the screen border in black.
There you have it—now you know how to revive your old 8-bit machines in a modern and comfortable environment. No more excuses not to dive back into assembly and create the demos and games of your dreams!
And if you’re a bit nostalgic, there’s nothing stopping you from transferring your programs to a real machine, armed with an old Commodore 1541 disk drive and a stack of D7s. Plus, there’s a robust community of enthusiasts always ready to lend a hand or a good old patch. Feel free to hang out on specialized forums like Lemon64 or C64-Wiki, where you’ll find a treasure trove of information, demos, and code snippets to repurpose.
With this VS Code + Kick Assembler + emulator setup, you can also tackle many other legendary machines: Atari 800, Apple II, ZX Spectrum—the list goes on. Each hardware has its quirks and secrets to discover, keeping you busy for years!