Kjetil's Information Center: A Blog About My Projects

Terminal Mode Commodore 64 Emulator SID Support

I have added SID sound support to my tmce64 emulator and bumped the version number to "0.4". The SID is quite complicated so instead of trying to emulate it myself I have added a wrapper around the excellent reSID implementation, which is also used by the VICE emulator I believe.

I have based my wrapper around reSID version 0.16 which can be found here. There seems to be a newer experimental version available also, but I have not tried it.

I did not install reSID system wide, but instead just compiled it:

tar -xvzf resid-0.16.tar.gz
cd resid-0.16

This will result in a static "libresid.a" library being built in the hidden ".libs" sub-directory which needs to be pointed to in the tmce64 Makefile along with the reSID header files.

The tmce64 0.4 release also contains some other improvements and bug-fixes, but most notably a simple implementation of the VIC-II raster interrupt which is used by a lot of demos. However the accuracy is far from perfect so expect many demos to fail, especially later ones that rely on very precise timings. Support for undocumented 6502 opcodes was merged from the ASCII Atari 2600 Emulator project. A joystick handled by SDL2 is now also supported, but only plugged in the C64 port 2.

A challenge with reSID and SDL2 audio is to keep them in sync, so that reSID writes audio data at approximately the same speed as the SDL2 audio callback can read it. I have solved this by letting reSID directly control the overall emulation speed to catch up or let go if one or the other falls behind. There is still some problems if "warp mode" is activated where the sync is lost which will cause bad audio while attempting to catch up.

Version 0.4 can be downloaded here but the GitHub repository has also been updated.

I have uploaded some videos to YouTube that shows the reSID sound implementation:
* Late 80's "Future Composer 2.0 Intro" demo.
* Late 80's "In Full Gear" demo in monochrome mode.
* Modern "Digioi" game with heavy PETSCII graphics.

Topic: Open Source, by Kjetil @ 17/02-2023, Article Link