Building a Commodore 64 Emulator

This emulator allows one play to games designed for the Commodore 64 8-bit system. It has been ported to the ODROID-C2 Single Board Computer (SBC).

Figure 01 - Commodore 64 Emulator
Figure 01 - Commodore 64 Emulator

Following are the steps involved in obtaining the source code, applying relevant patches and running the emulator. I was able to contribute some patches to the master code base. It was not easy to solve the various issues, but with some good help from the project maintainers, it is now available for all.

Checkout the source and apply a patch

First, we need to obtain some prerequisites:

$ sudo apt-get install bison
Then checkout the source and apply the no-border patch for VIC-II Commodore machines if you wish. This will remove the border of C64 and C128 machine models - the games are way better to view without it. This is more of a quick and dirty way to do it, a better approach would be to add it to the libretro config. If a game draws inside those borders it will not work and the application will crash. However, a lot of games do not draw borders.
$ git clone https://github.com/libretro/vice-libretro.git
$ cd vice-libretro
$ wget -O noborder.patch https://pastebin.com/raw/VwtSDj50
$ patch -p1 < noborder.patch
You can then start to build a Commodore machine of your choice. The valid machine types include the following:

  • x128
  • x64
  • x64sc
  • x64dtv
  • x64scpu
  • xplus4
  • xvic
  • xcbm5x0
  • xcbm2
  • xpet

You will need to specify the EMUTYPE variable followed by the machine type, reflecting your build choice. If left unspecified, x64 (C64) is selected as the default.

$ make EMUTYPE=x64 -f Makefile.libretro -j7
If you want to build more then one machine type, do not forget to run clean (make EMUTYPE=x64 -f Makefile.libretro -j7 clean) on the project otherwise the core will not work.

Apply RetroArch config

To apply the RetroArch configuration, copy the binary into RetroArch core folder:

$ cp vice_x64_libretro.so ~/.config/retroarch/cores/ .
Start RetroArch select the vice core, then either start the core with or without a game. Press the Guide button on your game controller or F1 on the keyboard and scroll down to Options, select it and disable DriveTrueEmulation->OFF, and set Controller0Type to “joystick”

I also enable a Aspect Ratio of 16:10, which I think is a good compromise between 4:3 and 16:9:

Settings -> Video -> Aspect Ratio -> 16:10
With the Start button, you activate the nuklear GUI settings (select button has to pressed once to activate mouse). From there, you can choose the C64 Joyport, machine cpu, sid type and more. The Onscreen keyboard is activated with the “X” button (Xbox layout).

References

http://vice-emu.sourceforge.net/ https://forum.odroid.com/viewtopic.php?f=98&t=32173#p233998 https://youtu.be/ItkppnXWd9U

Be the first to comment

Leave a Reply