With the site up and running, I figured I’d next look at some sort of development environment to work with. My initial thoughts were to fire up my C64 and program directly on that. After some consideration I decided that this would not be the best approach. Having the C64 hooked up all the time at my desk would take up a lot of space. Plus I’d need to source a TV and find room for that too. Then there is the whole dealing with disks and typing on the C64 keyboard. While it would be the more authentic way to develop on it (and how I used to do it), it would be too counter productive. It’s a shame, I was looking forward to using my Action Replay cart again.
So, the next option was to look at some sort of cross assembler that would allow me to develop on my PC and then build the files into a prg / d64 file that could be run on an emulator. In the long run I plan to purcahse an Ultimate 1541 device to allow my creations to run on a real C64, and this uses prg / d64 files from a SD card. So this method should work fine. It also allows me to use an editor of my choosing.
After some research online, I found a number of options available. To start with, I’ll be using the DASM assembler to compile my code into .prg files. For an emulator I’ll be sticking with VICE x64, which I’ve used for some time when playing emulated C64 games. For editing, my preference is to stick with Sublime Text 2, which I use daily.
Here are some links to the tools I’ll be using.
I also downloaded an assembly syntax highlighting that would suit DASM. This was the best I came across, but it has some faults. I’ll work with this until I can find a better one. The download for it can be found here – Syntax plugin
With a basic environment ready to go, it was time to actually write my first piece of C64 code in almost two decades. To keep it simple, I decided to write a small program to loop endlessly and change the screen colour. This can be done in a few lines in both BASIC and assembly language. I thought I’d try both.
First up, I’ll tackle the BASIC version. Thankfully I still have hard copies of my C64 Owners Manual and Programmers Reference Manual, although both of these manuals are available online, and have been bookmarked. Typing this straight into the VICE emulator and running:
Done. Now to convert this into an assembly language version and compile it:
Damn, a few errors.
– error: Unknown Mnemonic ‘6502’
– error: Unknown Mnemonic ‘$1000’
– error: Unknown Mnemonic ‘inc’
– error: Unknown Mnemonic ‘jmp’
After some investigation, turns out DASM is picky about spacing on the processor and org commands. Each requires a single space at the start of the line. With the correct spacing applied, the code compiled successfully. I attached the program to VICE and ran it:
Looking at the two screen shots of the test program running, it’s already so obvious the speed advantages assembly language offers (look at the number of background colour changes per screen refresh).
That was all relatively painless and a nice easy reintroduction to some basic and 6510 assembly. My development environment will certainly evolve over the next 12 months and I will continue to make some time to research what other people have done (or are using) to see what I can do better. I’m going to next go through some of my old notes and have a look for some raster code next up to job my memory on setting up some sort of interrupt.