Running C64 emulator VICE on a Raspberry Pi from the console (composite video, PAL)
One of my favority emulators is VICE (the VersatIle Commodore Emulator). Whenever I buy/get a new device, it is one of the things I like to run on it: all kinds of PCs (windows/linux), phone (android), tablet (android). So when I got my first Raspberry Pi for X-mas, I googled for C64 emulators + raspberry pi. I found PiMAME which offers more than a C64 emulator (MAME, Atari, Playstation). It is really good. When I tried to get "uinput" (user level input system for linux) working with the C64, I did not get things working:
F12 menu worked fine, but any other character output did not appear in the EMU. (I did work fine in the console, though). So I decided to compile the VICE sources myself to see whether that would solve the problem (probably not). If it doesn't work, I still can change the sources. This blog describes the steps to get VICE, or more specific X64, running from the console.

Setup:
  • Raspberry, Pi Model B
  • SD card 16GB
  • Raspbian (installed via NOOBS v1.3.4

First we need to install a number of packages via apt-get:
  • libice-dev
  • libreadline-dev
  • libsdl1.2-dev
optional packages (necessary for running X64 in X-windows)
  • libxt-dev
  • libxmu-dev
  • libxaw7-dev
  • libx11-dev
  • vim (vi IMproved)

sudo apt-get install vim sudo apt-get install libice-dev sudo apt-get install libreadline-dev sudo apt-get install libsdl1.2-dev sudo apt-get libxt-dev sudo apt-get libxmu-dev sudo apt-get libxaw7-dev sudo apt-get libx11-dev

Download the VICE-sources. I downloaded vice-2.4.5.tar.gz development sources from sourceforge on my PC and used FileZilla to get the tar ball to the Raspberry. We need to perform the following steps:
  • unzip and untar the file
  • goto the newly created directory
  • configure the source package (I'm not sure whether the -with-x=no is necessary. It did not harm either, so it's safe to use anyway
  • build the package
  • install the package


tar xvf vice-2.4.5.tar.gz cd vice-2.4.5 ./configure --enable-sdlui and --with-sdlsound -with-x=no make sudo make install

N.B.: I used many iterations to build everything. With every run a "make clean" before doing the next build. In one of the runs I had problems with "uistatusbar.h" not found in the xaw directory. I did a find . -name uistatusbar.h and found two. I copied one to the ./src/arch/unix/x11/xaw directory (I'll try to build again without this hack/sinn)
cp ./src/arch/sdl/uistatusbar.h ./src/arch/unix/x11/xaw/.

When everything has been build and installed, it's time to run the C64 emulator. I first tried x64. The first error I got was 'kernal' could not be loaded. To fix this, you need to manually copy the 'kernals' (and remove some extra copied files).

mkdir ~/.vice cp -r data/* ~/.vice/. rm ~/.vice/Makefile rm ~/.vice/Makefile.am rm ~/.vice/Makefile.in

Attempt 2. The kernal loads, but I get a blank screen without any error. Via ssh I was able to reboot the Pi. So I started browsing for answers to this problem. I found a lot of suggestion, but no solution but enough hints to get things right. Some of the tips:log the output to file. Use alsa for sound.
x64 -sounddev alsa -verbose 1>log.txt 2>&1 (logs both error and info to the file log.txt)
Unfortunately this didn't do the trick. Luckily combining multiply suggestions, resulted in a succesful recipe. I wrapped everything in a Bash shell script:

#!/bin/bash #DISPLAY=0 export DISPLAY sudo modprobe snd-bcm2835 x64 -sounddev alsa -sdlbitdepth 8 -sdlcustomw 768 -sdlcustomh 576 #if you need more logging, use this line instead #x64 -sounddev alsa -sdlbitdepth 8 -sdlcustomw 768 -sdlcustomh 576 -verbose 1>log.txt 2>&1

x64 works like a charm. Speed: 100%, 50fps, sound ok. Tested it with Boulder Dash

N.B. building x64 did not resolve the uinput issue. But I managed to use a different way to get key strokes in x64. I hope to blog about that soon...
On 2019-08-09, MikeGarcia wrote:

comment=Good+guide!%0D%0AThere's+an+issue+with%3A%0D%0A.%2Fconfigure+--enable-sdlui+and+--with-sdlsound+-with-x%3Dno%0D%0Ashould+be+just+(no+and)%3A%0D%0A.%2Fconfigure+--enable-sdlui+--with-sdlsound+-with-x%3Dno

Back to List

All form fields are required.
A confirmation mail for the comments will be send to you.