HowTo: Create A Chromodore 2017

Ever since I put it into developer mode, I have liked my Chromebook a whole lot more. It’s a very versatile, enjoyable device, and one of the nifty things it can do is emulate old Commodore computers, such as the VIC20 and C64. By way of installing a GNU/Linux desktop environment and the VICE emulator, one can “Chromepute” on their very own “Chromodore 2017”!

Important
This process requires full control of the Chromebook to gain access to developer mode, so it probably will not be possible for kids using Chromebooks provided by their schools to follow this guide. My Chromebook does not yet support Android apps, so I can’t test it, but I have read that one can use a Linux desktop by way of Android without using developer mode. Also, when in developer mode, anyone can power on your Chromebook, press the spacebar when prompted on the giant white warning screen, and perform a factory reset on the machine (erasing all your local stuff on the main drive). Be sure everyone who uses the device knows to press CTL+D rather than spacebar at the warning screen when turning it on.

Step 1: Backup Your Stuff
Most Chromebooks have an SD or MicroSD card slot for local storage, but a USB stick works well enough too. The next step will delete everything stored on your local storage space (Downloads folder), so go ahead and use your file browser to copy anything of importance from your Downloads folder to your external media or your Google Drive.

Step 2: Enter Developer Mode
This is pretty easy on most Chromebooks by doing the following:
– Turn off the Chromebook.
– Press and hold the ESC+Refresh with your left hand and while holding those keys, press the power button with your right hand. Borrow limbs as required.
– Press CTL+D at the giant, scary white warning screen and confirm your desire to wipe the device. This will take a while and eventually the machine will reboot showing you this screen (each and every time you turn it on from now on. It’s stupid, but hey, someone at Google thinks it’s cool…).
– Press CTL+D at the giant, scary white warning screen and it will continue booting. By default it will automatically boot after 30 seconds anyway.
– Reconnect to your network and log into the computer as normal.

If you’re new to this, I recommend reading the detailed tutorial at howtogeek.com.

Step 3: Welcome to a Useful Terminal!
By default Chromebooks come with a fairly useless terminal program called Crosh, however when in developer mode Crosh gains access to a standard Linux terminal, complete with plenty commands/programs. Open up a terminal by pressing CTL+ALT+T and typing shell at the prompt. Vi/Vim users rejoice, Nano/Pico nor any other basic text editors are included (but one can add nano!). This is where/how you will install and run your GNU/Linux desktop, by way of a cool utility called Crouton. Poke around here for a bit to get an idea of how Linux is organized in its ChromeOS flavor.

Step 4: Install A Linux Desktop
Crouton is nifty, because it uses the same installed/running Linux kernel as ChromeOS, allowing you to run both environments at the same time in normal “real hardware” mode. You can even uses SHIFT+CTL+ALT+Back/Forward to switch between the ChromeOS desktop and the Linux desktop on the fly. Crouton also comes with helpful abilties, such as being able to backup/restore it’s self contained environment. The Crouton website has more detailed information on how it all works. Lifehacker.com has a more indepth guide.

Before moving forward I will note that it is possible to use several distributions of Linux as the basis for your Chromodore. I chose to use Ubuntu 14.04 (Trusty), because its repositories are full of great, stable, and easy to install software. Ubuntu 16.04 (Xenial) is the default and it works fine for this purpose as well, so that’s what I will use for the guide.

The following commands will download Crouton and setup your environment:
cd ~/Downloads
wget https://goo.gl/fd3zc
sudo sh ~/Downloads/crouton -t xfce

The installation will take quite a long time, as it automagically downloads and configures the software. While it’s chugging along, have a look at the command cheat sheet for Crouton to learn how to manage and customize it.

The files for your Linux desktop will be located here:

/mnt/stateful_partition/crouton/chroots/xenial/

This is handy, as it allows you to manaully install new functionality into the Crosh shell’s “shell” program by symbolicly linking things in /usr/local/bin and /usr/local/lib to things in the Crouton file system (such as nano and the libinfo.so.5 it requires). Anyhow, on with the Chromodore!

Note: It is possible to use the xiwi system of Crouton to run VICE in a Chrome tab/window, however I have found that the performance is unacceptably slow when doing so. VICE runs great in Xfce though!

Step 5: Configuring the Desktop
Now that your Linux desktop is installed, you can run it by typing the following into your Crosh shell:

sudo startxfce4

This will put you directly into Xfce. To flip back to the ChromeOS desktop, press SHIFT+CTL+ALT+Back. Use SHIFT+CTL+ALT+Forward to go back to Xfce. To turn off Xfce, simply log out of it using the log out option on its menu (note that choosing the “turn off” option in Xfce will turn off the whole computer).

I personally like Xcfe so much that I use it as my main desktop on all my PCs, but for those who may not be as well versed it can look and feel a little dated. It’s actually super configurable, able to look like anything from BeOS to Windows 10. So, go ahead and Google “customize xfce ubuntu” and get it setup to your liking. Keep in mind that when it comes to Chromebooks with only 2GB of RAM, such as mine, less is more. Here’s a screenshot of my Chromodore desktop.

I like to KISS. Do you? šŸ™‚


Step 6: Installing the VICE Emulator
VICE is an open source program that uses software to emulate the hardware of several Commodore machines, thanks to the combination of great minds and C++. The documentation states that the Commodore 64 is the main focus of the project and the other machines are not as complete, however they’re all able to use BASIC and machine language programs typed by the user (and saved/loaded to/from disk images saved on the Linux machine). VICE is included in the Ubuntu repos, but ROM images for machines are not included, so you will need to download and install them separately.

Install VICE by opening a terminal in Xfce and typing:
sudo apt-get install vice

Now you will need to download and extract the source code for VICE, so that the ROMs can be copied to where VICE expects to find them. Ubuntu 16.04 will install VICE version 2.4, so you’ll need the version 2.4 source code file for Linux. Download and extract it in your terminal with these commands:

cd ~/Downloads
wget http://www.zimmers.net/anonftp/pub/cbm/crossplatform/emulators/VICE/old/vice-2.4.tar.gz
tar xfzv vice-2.4.tar.gz

Copy the ROM files to your system using the following command:
sudo cp -vR ~/Downloads/vice-2.4/data/* /usr/lib/vice

Step 7: Running VICE
Ubuntu conveniently adds links to all of the different Commodore machines that are supported by VICE in the “Other” category of Xfce’s default menu. I have found that sometimes that category doesn’t show up when using the more modern looking Whisker menu though. To run the emulators from a terminal one would assume they’d type vice -something, but nope, instead one must type one of the following commands:

x64
x64dtv
x64sc
x128
xcbm2
xcbm5x0
xplus4
xpet
xvic

Presuming you want to use the most popular machine, the Commodore 64, go ahead and run the emulator now.

Step 8: Configure VICE
Most games require a controller to play them. Some NEED only a single controller in joystick port 2, while others don’t mind if controllers are setup on both controller ports. This is by far the most important practical setting you will need to know.

If you have a real USB controller or joystick, plug it in and the Linux kernel should pick it up OK. If not, poke around on the Internet to see if anyone has steps to get your model working. VICE will see it and will automatically assign the directional pad or stick to the stick and any buttons to the single button that is expected on the Commodore controller.

Tell VICE about your joystick here:
Settings > Joystick settings > Joystick in port #1 > Anolog Joystick 0
Settings > Joystick settings > Joystick in port #2 > Anolog Joystick 0

Again, for some games you will need to switch one of those to “None” for your input to be recognized.

If you don’t happen to have a controller, fret not for VICE has a solution! It is a little bit annoying on a Chromebook, due to the lack of a number pad, but you can use the keyboard as a controller. The annoying part is that when the “keyboard joystick” is toggled on, it’s on all the time, even at the BASIC prompt, so ya gotta toggle it off when typing in commands. Toggle it ON/OFF with SHIFT+ALT+J (Settings > Joystick settings > Allow keyset joystick), define the keys you would like to use (Settings > Joystick settings > Define keysets…) and “plug in” the keyboard-joysticks, as above in the joystick port config, only choose Keyset A rather than Anolog Joystick 0.

Apart from that, have a look at the other various options in the settings menu. There are some for sound, video, and specific machine type, etc. When you’re finished choose the “Save Settings” option in the settings menu, so they will be loaded every time you open the emulator.

Step 9: Using VICE
I am by no means an expert at using this awesome tool, but I understand enough to go through the motions of loading and saving programs. The general idea here is that rather than using physical disks, tapes, or cartridges, VICE uses files that contain the contents of what is on those physical mediums. These files are generally referred to as “disk images” or simply images (a common term for many computer archive files). Traditional floppy disks and cartridges are most often saved in the .D64 format, such as mydisk.d64, while tapes use the .T64 or .TAP format. BASIC programs can be saved and loaded from .PRG and .P00 files. Conveniently, VICE is smart enough to automatically load the various file formats, even ones that are contained inside zip files, by way of the “Smart-attach disk/tape…” menu option.

Here are some things to do…

Download a game and play it…
– Pick something of interest at http://www.c64.com/games/ or elsewhere on the interwebs.
– Run it: File > “Smart-attach disk/tape…” > find the .zip file you downloaded > click the “Auto Start” button.
– Wait while it loads.
– Play the game!
– ALT+D will toggle between window and full-screen mode.
– To quit the game simply reboot the emulator with File > Reset > Hard

Note that the Alt+F12 reset shorcut doesn’t work on a Chromebook, because F12 is the power button.

Write and save a BASIC program…
– Create and load an empty disk image so you have a place to save your program. File > Create and install an empty disk image > Unit #8… > give the file a name, pick a sensible place to store it on the computer (~/Downloads/C64/myDisk.D64 for example) > click the Save button.
– Write a little program, such as…
10 FOR X=1TO10
20 PRINT “HELLO WORLD!”
30 NEXT
– Save the program (contents of BASIC memory) to the disk
SAVE “HELLOWORLD”,8

Load a BASIC program from a disk…
– File > Attach disk Image > Unit #8… > find your disk image and double click it.
– Disply the contents of the disk and run the HELLOWORLD program
LOAD”$”,8
LIST
LOAD”HELLOWORLD”,8
RUN

Those basics cover the majority of what the average person would do with their Chromodore, but there is a lot more you can do. There is a ton of information on the Commodore computers on the Internet, including PDF versions of books and full schematics of the hardware. There’s even an excellent IDE for developing programs for them on a Windows PC called CBM .prg Studio. Personally, I find that a picture of my VIC20 keyboard is an invaluable resource, as the PC key mapping for VICE is not super intuitive.


So there ya go, you’re now the proud owner of your very own Chromodore 2017. Go forth and have fun on your Chromebook, 8 bits at a time.

An ALT+D away from full screen C64 fun!