- The ‘Working’ Commodore 64/128 Diorama and Raspberry Pi VICE Emulator
- -> Installing the VICE Commodore Emulator for Console Mode on a fresh Raspberry Pi 4
- Mirroring Raspberry Pi HDMI Video to a ST7789 1.3 inch LCD Display
- Patching the VICE emulator to light up floppy drive LEDs
Last Updated on May 24, 2021.
At the time of this writing, there’s no binary package ready to install on the Raspberry Pi 4. Also, I need to make sure I can run the VICE emulator on the console and not in X-Windows for my diorama project. That install isn’t difficult but isn’t a single line or two either, so we’ll start from scratch on a fresh Raspbian lite install. This article assumes some familiarity with how VICE works. Let’s install VICE on a Raspberry Pi 4!
Raspberry Pi 4 Version Log
See below for the versions of Raspberry Pi OS and VICE used – this document has evolved over time.
- Raspbian Pi OS Lite March 04, 2021
- SDL 2.0.14
- VICE 3.5 December 24, 2020
To that end, the video below is no longer 100% accurate. It still covers the general setup tasks, but SDL’s compile has changed.
Step 0 – Hardware before the Software
This part is pretty simple – you’ll need:
- Raspberry Pi 4 Model B, or Raspberry Pi 3B+
- Micro SD Card (we’re generally at the days of 16GB or higher)
- Micro HDMI cable (or full HDMI if you’re using a Raspberry Pi 3B+)
- Keyboard / Mouse for initial setup, Wifi connectivity for later SSH connectivity.
Step 1 – Write The Raspberry Pi 4Image
We’ll start with a fresh SD Card and a Raspberry Pi 4. We’re going to burn Raspberry Pi OS Lite (I’m not using a window environment) on to the SD Card using Balena Etcher.

Step 2 – Boot the Raspberry Pi and get connected.
We know our default password is raspberry and our default user name is pi. You should change these if you’re going to keep this install around. Regardless, we need to set just a couple of things before we start with VICE – such as my desire for SSH access so I could copy/paste commands more easily. Here are those steps after you give yourself a good old fashioned sudo raspi-config
:
- Set hostname to vice-pi-install (This makes it unique and through bonjour lets me access it from my Windows PC as vice-pi-install.local.)
- Set WIFI up to my access point (Country Code and SSID)
- Allow SPI interface access (my diorama is going to be controlling an LCD through SPI)
- Allow SSH interface access (so we can copy/paste from a Windows SSH client)
- Setup locale, keyboard, etc.
- Verify Internet Connectivity (ping google.com)
- Perform your normal
apt update / apt upgrade
commands to update your system.
sudo apt update
sudo apt upgrade
Step 3 – Download the install script
I’ve created a script that does this on a fresh Pi install. You can just download it, chmod +x the script, and run it. Look it over yourself if you’re concerned about just running some guy’s script.
It’s available here: https://raw.githubusercontent.com/erkrystof/vice/master/install-vice-3.5-raspi-4.sh
I execute it with this command directly:
wget -O - https://raw.githubusercontent.com/erkrystof/vice/master/install-vice-3.5-raspi-4.sh | bash
I’ve also decided to just script most of this out, but I’ll cover the main points:
- Performs the general sudo apt update/upgrade
- Downloads SDL 2.0.14 from a fork of RetroPie’s fork of SDL2 with pi specific modifications
- Enables kmsdrm, video-rpi, and a few other tweaks
- Compiles and installs the modified SDL2.0.14 library – this is based off not SDL itself but RetroPie’s SDL mirror for 2.0.14
- Downloads VICE 3.5 compilation dependencies
- Downloads VICE 3.5 source code from sourceforge.net
- Configures VICE to enable fast-sid options and the x64 ‘old’ build
- Installs VICE into your home directory (/home/pi/vice-<version-number>) – Because I dislike /usr/local for vice.
The latest version of the script will always be at the link above. It’s configured so if it runs into any error, it aborts. The script should be re-runnable except for the piece where we move some videocore headers around, you may need to ‘undo’ that and re-run the script at this point if it breaks in that area.
Why enable kmsdrm?
I’m not in a window environment, so we need to enable the kmsdrm video driver in SDL 2 for our VICE compile. Why? We want to run VICE from the console. Unfortunately, the SDL2 libraries from package repositories don’t have the kmsdrm driver piece enabled, so we’ll make our own. I’ll use a separate directory called sdl-work in my home directory.
We will build SDL2-2.0.14 from RetroPie’s fork that has Raspberry Pi specific modifications. Part of the compilation below is from RetroPie’s SDL 2.0 install script. To learn more about the excellent RetroPie project, head on over to their site here. I’ve made a fork off that repo and that’s where I’m pulling from in my script – it’s just in case I need to make any tweaks.
Step 4 – Setting the Video Driver in Raspi-Config
This step seems to no longer be necessary! We used to have to go into raspi-config and enable the ‘Fake KMSDRM’ driver, but with changes to how we’re building SDL compared to prior versions, there doesn’t seem to be that need to change the driver configuration anymore.
Step 5 – Download a demo and see it perform horribly
I downloaded a simple demo from csdb.dk by Booze Design known as ‘The Elder Scrollers‘. Downloaded the .D64 file and uploaded that to the VICE Pi. Moving into the /home/pi/viceinstall/bin directory, I typed ./x64sc and was greeted with an old blue friend:

Now, depending on how this all comes together, you might have a really tiny C64 screen in the corner of your big monitor. Simply hit F12, scroll down to Video Settings -> Screen Settings -> Fullscreen.
However, this new build of VICE 3.5 and the latest Raspberry Pi OS had horrible performance right away. I noticed stuttered audio, general sluggishness, and just generally worse performance than I experienced with Buster Lite and VICE 3.4. I do remember reading about a change in VICE 3.5 that may be part of the issue – they did away with some synchronization of audio in their build, to this effect:
- Emulator timing is now directly driven by the host system audio device. If sound emulation is disabled, timing is synchronized with the host clock. As part of this change, the choice of sound synchronization method has been removed. -https://vice-emu.sourceforge.io/NEWS
I also noticed this flooding my SSH console:
Warning - sync is far too late, resetting sync
Here’s where things get strange. I think the combination of two things made the demos perform better:
- Only execute from the console window (don’t let your SSH session get flooded with the above log statements)
- Apply these settings in your VICE Config:
- Machine Settings -> Model Settings -> SID Settings:
- SID Model -> 8580 + digi boost (ReSID)
- reSID sampling method -> Fast
- Video Settings -> Size Settings
- Disable double size
- Disable double scan
- Select Fullscreen
- Video Settings -> Render filter
- Select ‘None’
- Sound Settings
- Buffer size 50msec
- Frequency 22050 Hz
- Machine Settings -> Model Settings -> SID Settings:
After that, I made sure to exit and restart the emulator.
The settings above caused the x64 binary to write this reference config file I have: (/home/pi/.config/vice/sdl-vicerc)
[C64]
MenuKey=293
MenuKeyUp=273
MenuKeyDown=274
MenuKeyLeft=276
MenuKeyRight=275
MenuKeyPageUp=280
MenuKeyPageDown=281
MenuKeyHome=278
MenuKeyEnd=279
SoundDeviceName="alsa"
SoundSampleRate=22050
SoundBufferSize=50
AspectRatio="1.000000"
VICIIVideoCache=0
VICIIDoubleScan=0
VICIIDoubleSize=0
VICIIFullscreen=1
VICIIFilter=0
SidResidSampling=0
SidEngine=1
SidModel=2
ETHERNETCARTBase=56832
Acia1Base=56832
Something may still be strange about why the stuttering appears, but this fixed it for me. It definitely didn’t feel like one change alone was going to do it. Nevertheless, once I made those changes, demos ran more smoothly. I haven’t done deep tests of joysticks and other parts yet, but sound doesn’t stutter and graphic motion is smooth again.
Step 6 – Apply settings and watch a demo perform smoothly
Finally, after modifying my settings, restarting VICE, and after autostarting the demo image I downloaded, I was able to sit back and enjoy classic SID sound from the Elder Scrollers demo:

With that, we finish the install of VICE on a Raspberry Pi 4 in console mode as the foundation of my Diorama 64 project. Any thoughts or concerns, things that didn’t work well for you with your install? Leave a comment down below or join the discord at https://discord.gg/wbngTy8 and we can chat. Next up: the Raspberry Pi 4 and the LCD display turned monitor.
Raspberry Pi 3B+ Instructions
** May not work, I have NOT updated this yet for VICE 3.5 **
Generally, the build is very similar. I’m going to skip all the discussion points and run down what I think seems to work on a Raspberry Pi 3B. The key differences are how we build SDL. I didn’t seem to need to change any graphic related driver setting to get this to work.
sudo apt update
sudo apt upgrade
#SDL for Raspi-3B dependencies
sudo apt-get install libfontconfig-dev qt5-default automake mercurial \
libtool libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev \
libudev-dev libtiff5-dev libwebp-dev libasound2-dev libaudio-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxss-dev \
libesd0-dev freeglut3-dev libmodplug-dev libsmpeg-dev libjpeg-dev
mkdir ~/sdlwork
cd ~/sdlwork
hg clone http://hg.libsdl.org/SDL
cd SDL
./autogen.sh
./configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland \
--disable-video-opengl --host=arm-raspberry-linux-gnueabihf
make
sudo make install
cd ~/sdlwork
wget http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz
wget http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
wget http://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
wget http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.15.tar.gz
tar zxvf SDL2_image-2.0.5.tar.gz
tar zxvf SDL2_mixer-2.0.4.tar.gz
tar zxvf SDL2_net-2.0.1.tar.gz
tar zxvf SDL2_ttf-2.0.15.tar.gz
cd SDL2_image-2.0.5
./autogen.sh
./configure
make
sudo make install
cd ..
cd SDL2_mixer-2.0.4
./autogen.sh
./configure
make
sudo make install
cd ..
cd SDL2_net-2.0.1
./autogen.sh
./configure
make
sudo make install
cd ..
#Interestingly enough TTF builds just fine on the 3B.
cd SDL2_ttf-2.0.15
./autogen.sh
./configure
make
sudo make install
cd ..
#Now, on to VICE for the Raspi 3B
sudo apt install libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev \
libpcap-dev automake bison flex subversion libjpeg-dev portaudio19-dev texinfo xa65
mkdir ~/vicework
cd ~/vicework
#3.4 is the latest VICE release
svn checkout svn://svn.code.sf.net/p/vice-emu/code/tags/v3.4/
cd ./v3.4/vice
./autogen.sh
./configure --prefix=/home/pi/viceinstall --enable-sdlui2 --without-oss --enable-ethernet \
--disable-catweasel --without-pulse
make -j $(nproc)
# I got an error here for the running of make install - you may or may not need to do the sudo.
sudo make install
#after this point, I went directly to the vice install directory and ran it
cd ~/viceinstall/bin
./x64sc
References:
- Balena Etcher
- Enabling Bonjour for your Raspberry Pi
- VICE Homepage
- Lemon 64 Thread on Custom SDL Build
- SDL on Raspi (for 3B compile)
- Compiling SDL2 from source
- x64 vs x64sc VICE binaries
- The Elder Scrollers Demo
Thank you for providing your guide. A couple of differences for my setup:
1). A Pi 3B+
2). Using the 7″ LCD
After following your guide and trying to launch x64sc, I get the SDL error that there is no available video device and that archdep_init failed.
I’m certain I followed your guide as I’m not a linux noob, so could these issues be related to the HW differences?
Hi Bill! Good question. I did *not* try this on a 3B+ yet. I do have one available though, let me run through it and see if I can update the article and respond back to you with my results.
Also – what LCD display is that – an HDMI display? Is it your primary?
Bill, looks like I figured a way to make this work – I created another section at the end of this article for the Raspberry Pi 3B+. Give it a shot and let me know if that works. I just tried it on a 3B+ and was able to get the C64 ready screen up. I didn’t do much testing beyond that.
Hi, thanks for this guide 🙂
I’ve tried to build vice on Raspbian Buster Lite.
i followed your instruction and tried to build on my Rasp 3B and on Rasp 4B the vice emulator.
Everything goes well, except it stops in the final make with aseries of “undefined reference” error:
make[3]: [Makefile:1862: c1541] error 1
make [2]: [Makefile:2008; all-recursive] error 1
make[1]: [Makefile:1763: all-recursive] error 2
make: [Makefile:506: all-recursive] error 1
Can you point me out what’s wrong?
Thanks,
Giuseppe
Giuseppe,
I’ve not seen that error – it’s possible something has been updated, either the VICE source code or something in Raspbian that’s changed.
When I get some time this weekend I’ll try rebuilding VICE on a fresh Pi 4B and see if I can reproduce the error!
Cheers,
Krystof
Thank you very much for your answer, yeah, i think too something has changed in the vice source 🙁
All the problems seem to come from “linenoise” lib.
If you have time and wish to recompile it, it will be fantastic 🙂
I really want to have a Vice Emu for my 3B and 4B.
Thanks once again,
Giuseppe
Giuseppe,
So far it’s been a bit ugly in two ways:
1. I can’t reproduce the error you’re seeing.
2. I can’t get a fresh install to work any longer.
So… I’m back trying to get it working again, perhaps through that work I’ll run into your issue!
Thank you for your reply Eric 🙂
If you can make it compile again, please update your post 🙂
Cheers,
Giuseppe
I was finally able to get a fresh recent install working, and it’s a bit of change to how SDL is utilized (I end up using RetroPie’s source)
I need to reformat the Pi again and start from scratch to make sure it’s a repeatable process. Once that’s done, in the next day or so, I’ll send an update out.
To that end, can you tell me if there’s anything unique to your Pi setup that you do or install? It might help me reproduce since even with all the changes I’ve made in the last few days, I still never saw the compile issue. Any software you also installed or other configuration tweaks you made?
Cheers,
Eric
Hi Eric,
glad you was able to compile it 🙂
I didn’t install anything else than just a fresh copy of Raspbian buster lite, then followed your instructions.
Everything worked well, every SDL2 lib compilation, Vice configuration worked too without any problem, only when i launched the command “Make” , after awhile it failed with the error i mentioned some day ago. the error seemed to refer to libLinenoise.
Please, when you have time and if you want, update your guides, they helped me very much 🙂
Cheers,
Giuseppe
Well, Giuseppe, I’ve updated the guide as best as I could. Feel free to give it a shot and see how it goes. The primary differences are going to be how SDL is compiled and installed (along with *not* rebuilding SDL-image and SLD-ttf), along with building VICE directly from the 3.4 tag instead of trunk. I hope it works for you! I’ve tried this on a 4 and 3B.
If that breaks in the same spot, see if maybe there’s a way you can turn up logging or debug (I’m not sure), perhaps there’s something more useful we can use to determine what’s going on.
Thank you very much for your work Eric 🙂
Yesterday i tried to compile SDL2 with your new guide, unfortunately i got some error :(( ( No luck at all)))
When i typed:
sed -i ‘s/libgl1-mesa-dev,/libgl1-mesa-dev, ‘”${conf_depends[*]}”‘/’ ./debian/control
I got error param s is not recognized…
Didn’t have any luck, anyway, i’ll try again, maybe i misprinted something 🙂
Thanks once again 🙂
Giuseppe
Hi Giuseppe,
It might help to copy that and paste it – if you’re typing it manually that could easily be a typo there. If you *did* copy and paste that, I may have an error on my end! 🙁
What I will do this weekend, which I should have a while back, is turn this into a script you can run. If I do that, I’ll update again and send you a link.
After many, many failures I finally was able to compile VICE for console on a RPi 3B. Thanks a lot for this tutorial! Great work!
Thank you very much, I’m glad it has worked out for you!
After running PKG_CONFIG_PATH= dpkg-buildpackage -b
I get the following errors (on Pi 4) 🙁
make[1]: *** [debian/rules:28: override_dh_auto_configure] Error 2
make[1]: Leaving directory ‘/home/pi/sdl-work/SDL-mirror’
make: *** [debian/rules:25: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
I wish Vice was straight forward to install, the Pi is such a great platform for C64 emulation.
Hi Ben, I share the same wishes. 🙂
Things change so often with libraries and system updates, I have a Raspi 4 I keep for nothing but build testing. So I’ll try and fire that up and do a fresh reinstall and recreate the issue. That whole dpkg-buildpackage bit was absolutely horrible to work through and document – that’s the first time I couldn’t just download source, build the custom library and utilize it in a straightforward fashion. The older method I had worked a bit better that way but later crapped out with the last raspberry pi buster update…. So I had to find an alternative working mechanism and landed on RetroPie’s solution.
Given that any of the above components, libraries, os, and retropie, can change independently, it’s going to be a never-ending struggle. So I’ll start from a fresh install and execute my grouping of commands on this page and see if I run into the same issue as you did.
I did get it working using libsdl2-dev instead of the compiled special version, which is brilliant! It’s very hmmm “interesting” compared to the Windows version which is comparatively simple to configure. I haven’t figured out how to get a gamepad to work. Also having a lot of “Sound: Warning – Buffer drained” although I’ve increased the buffer to 150ms and changed from reSID to sid Fast.
Ok the gamepad works after some further tinkering. Thanks for your hard work putting this all together.
Excellent, and you’re welcome!
That’s great to hear – the libsdl2-dev might have been updated some since I last tried it. Would you mind pointing me to the repo you pulled it from so I can try that out instead? I’ve not tried a gamepad on vice myself, but I have done a regular 9 pin joystick with a USB converter and that did work as a joystick.
The sound buffer drain error is something I also get – I’ve generally been ignoring it and in general I’ve not had many sound issues in the games I play – but some of the demoscene eye-candy I’ve tried do require some SID setting changes now and then.
It was just the standard old “apt install libsdl2-dev” that seemed to do the trick.
I’ve just tried the “PiKiss” script with a fresh image and that seemed to work really well too (PiKiss script link below). There were some differences in the dependencies which you may find interesting:-
Same in both: subversion flex bison xa65 texinfo libasound2-dev
Unique to Jose: libsdl2-dev (as we know) autoconf libglew-dev libieee1284-3-dev (parallel port why??)
Unique to Krystof: libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev
libpcap-dev automake libjpeg-dev portaudio19-dev
This script… https://github.com/jmcerrejon/PiKISS/blob/master/scripts/emus/commodore.sh
Beautiful, Ben. Thank you so much. This will definitely help me get some updates going for the install instructions.
Hi Eric,
I deeply appreciate that you are making this guide for compiling vice. Is there any news on when do you plan to provide an update to the instructions? Well, I have a Pi 3B and I added some wiringpi lines to vice source in order to emulate the drive led status into an actual led connected to the gpio. It was shown in on Perifractic’s Retro Recipies channel on Youtube. I contacted the author of this Idea and he gave me some guidelines on how to make this to work.
The only os that worked with compilation was combian. Of course, I wanted to do the compilation on a fresh raspberry os lite so i followed your instructions from above and I have the following error coming up while compiling:

Any ideas what is the problem? Maybe you could update your instructions for the rpi 3B in relation to the latest raspberry os version?
Thank you in advance
Hi Michal,
Thanks for the note. I’ve not done the build on the 3B in a while, so I can validate that with the latest raspberry OS version. However, while I half-expect it to work on my machine without issue, it still may not on yours, given your error. Sounds like, based on that picture, your compilation on combian is acting differently than your compilation on raspbian. If combian worked then it’s most likely ignoring your implicit function declaration.
Off the top of my head I think there’s two ways around your problem:
In my case, I decided to declare mine when I was creating my mini 1541 LED Drive in my diorama, if you’ve not seen that article it might help:
https://krystof.io/patching-the-vice-emulator-to-light-up-floppy-drive-leds/
Thanks for the feedback. Please, validate the installation with 3b and latest raspberry os lite. I would appreciate a small tutorial.
Thank you in advance
Hi Krystof,
I’ve tried the procedure for Raspberry Pi 4 with the new Vice 3.5 and unfortunately it’s broken. If you have time and wish, please update your guide for the new Vice.
Cheers,
Giuseppe
I’m going to work on that this holiday weekend! Happy New Year!
Hi Krystof,
Any news on compiling Vice 3.5?
I wish there was, Giuseppe. I really do. I’ve been working days and nights for work for the last few months now, I wish I could say that had signs of slowing down but I’m not feeling optimistic about it. This is *the thing* I want to work on in spare time. I’ll update this page when I have something. 🙁
No pressure :))),
It’s ok and right that way :), i mean, in a period like this, it’s a luck to have a regular job :))
Have a nice day 🙂
Giuseppe
You too, Giuseppe. I’m going to try and dedicate Sunday morning to this in a live stream on Twitch (It’s a workshop stream, so it will be me trying to figure it out, since I don’t know how to do it myself yet). I should be able to get some movement on it. 🙂
Hey Giuseppe what are the advantages of 3.5 you want to see?
Hi Ben,
Thanks for your reply and procedure to compile Vice 3.5 on Raspberry Pi.
I’m very curious to try the lower input user latency and a 50hz scrolling 🙂
I will try as soon as possible.
Thanks once again.
Giuseppe
I’ve updated this post, Giuseppe, see if that works for you, and good luck!
sudo apt-get install flex bison xa65 libgtk2.0-dev texinfo libxxf86vm-dev dos2unix libpulse-dev libasound2-dev
sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra
download this to your Downloads folder – http://libsdl.org/download-2.0.php Download SDL2-2.0.14.tar.gz – GPG signed
cd ~
tar xvfz ~/Downloads/SDL2-2.0.14.tar.gz
cd SDL2-2.0.14
./configure
make
sudo make install
download this to your Downloads folder – https://www.libsdl.org/projects/SDL_image/ Download SDL2_image-2.0.5.tar.gz
cd ~
tar xvfz ~/Downloads/SDL2_image-2.0.5.tar.gz
cd SDL2_image-2.0.5
./configure
make
sudo make install
download this to your Downloads folder – https://vice-emu.sourceforge.io/ Download tarball: vice-3.5.tar.gz
cd ~
tar xvfz ~/Downloads/vice-3.5.tar.gz
cd vice-3.5
./configure
make
sudo make install
Now the executables will be found here; usr/local/bin
Beautiful. I’ll start with this when I stream the workshop tomorrow, thanks, Ben!
Seems to be a fair bit of slow down and haven’t had a chance to figure it out yet. How do I watch the stream what’s your twitch name?
https://www.twitch.tv/mrkrystof is the link, sir. I’ll be on about 7am Sunday morning, CST / -6 GMT.
Credit to Dave for my copy paste above. https://techwithdave.davevw.com/2021/01/
Thanks, Ben, and thanks for hanging out a bit on the stream today. I’ve updated the guide and was able to get it running in console mode and get around some really bad audio stuttering.
Excellent guide! I have it working and the suggested settings make all the difference.
I’ve added a line to RC.local to make it start on boot. USB gamepad working with zero issues.
So happy to hear that, sir. I’m glad to hear you’re reporting success with gamepads as well!
Happy holidays to everyone 🙂
It’s now time to compile Vice 3.6, who knows if the described procedure works with this new release….l’ve to try :))
Happy Holidays, Giuseppe! Yes indeed – versions go up, and the guides become out of date – It never ends! 😀 I’ll have to give it a shot and see if it works out. Having to do the separate SDL library stuff has always been the bummer – plus with the latest version of Raspbian – who knows how this will play out. I’ll try as well and we’ll see what happens!
Hi Eric 🙂
Unfortunately i had no luck in compiling Vice 3.6, did you try?
Cheers,
Giuseppe
I have not yet, Giuseppe, but I’ll give it a shot this weekend or sooner and see. Always upgrading… 😀