26 October 2025

SNARK simulator code for the C64

Following a recent post on the SNARK simulator code used as a basis for one of my University projects, I have found and updated the code from the original PET version to run on the C64.

SNARK Simulator (Commodore)

Following the recent post of one of my old University projects – I searched around on the internet and unearthed the original PET code of the SNARK simulator in PDF format.

The original code base of the SNARK simulator comes from the book Fundamentals of Computer Science © Andrew J. T. Colin 1980 which was written for the Commodore Pet.

I put the source code from the DF into VS Code and using the VS64 extension started to get this into a running state.

Once I had a configured BASIC project using the extension to be able perform a build and run of the code into the C64 VICE emulator, I then set about dealing with any transcription errors from the source code.  Being code based on the Commodore PET then the BASIC code ran almost exactly.

When the code was running cleanly I started to add some additional functions to make use of the extra features available through the C64 and VICE program.

These were mainly a disk save and disk load function so the SNARK programs could be written out to disk (d64 image) rather than tape for ease.  Keeping in the spirit of the original code I kept all of the routines for doing this as BASIC code and used the code here as the basis for this code as it was well explained. 

I made use of a couple of POKE calls in the program to improve some of the handling of user input and in support of some in built help commands to refer to when using the simulator.

 

vice-screen-2024062314285307
vice-screen-2024062314562709

I have placed the code into a GitHub repository which can be found here if anyone wants to look at how the SNARK simulator now looks like.