Long time, no blog.
Let's start at the beginning. In 2009 I wrote my first version of a SID Emulator, running directly on the Atari 8-bit hardware. The emulation loop ran in the main loop and synchronisation was done with STA WSYNC. I had created a raw register dump of a .sid file with a modified version of TinySid and every frame I left the main loop a few times for a few cycles to stuff the SID emulation engine with new values. I didn't take long to realize I didn't have quite enough time to do much else.
I wanted to ditch the idea of playing a register dump. Even RLE compressed it took way too much memory to store a decently sized song. I wanted to run the original C64 player routine. That led me to the source code of siddasm and a rewrite with more features, which I called siddasm2 (really original).
I moved the emulation code to page zero to save some cycles, but that did not really help enough. At the same time, I stumbled upon a bug in Atasm and instead of fixing that, I ended up writing my own assembler. I had always wanted to do that. I won't go into details here. See my previous blog entries on shasm65 and siddasm2.
After that, I kind of lost interrest, but a few weeks ago I continued this project. I completely rewrote my SID emulator in shasm65. Now the emulation engine was running of a timer interrupt, leaving the main loop free to periodically call a C64 player routine. This routine had to be patched though to write to shadow SID registers instead of the C64 hardware registers.
This is where siddasm2 came in again. Early in the process of disassembling Laxity's song "Freeze" I noticed that the resulting assembly code couldn't be assembled again by atasm AT ALL. Which shouldn't be the case. I fixed a few bugs in siddasm2 and shortly after that I was able to recreate the .sid file from source code with the help of atasm -r and unix dd (for the header). So far, so good.
Now I was able to patch the source code of 'Freeze' and run it alongside my sid emulation code. I added code that converted the shadow sid registers to values my engine could work with, added ADSR envelope handling, everything I used to do in my modified TinySid. A few debugging sessions later, I had it all working! After that, I disassembled and patched the International Karate tune. This triggered a new bug in my emulation, which is now fixed.
I sent out an example to Freddy (F#Ready on AA), which he turned into a youtube video and posted a link on AA to see what all of you would think about it. And now I figured it's time to release the source code and a few binaries to play with
Attached you'll find version 2.1 of siddasm2.
A slightly modified shasm65 which is now verbose in hex instead of decimal (but the original shasm65 is still fine to assemble the code, too. The assembler itself did not change).
.xex binaries for Laxity's Freeze, Rob Hubbard's International Karate and Jeroen Tel's JT42.
The source code for everything.
Regards and have fun!
binaries.zip shasm65.zip siddasm2-2.1.zip sid-songs.zip atarisid2.zip