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!

VIC-20: It’s Alive!

Ah, the things middle aged men do to recapture their youth. Some buy a sports car and date women half their age, while others buy old stuff and play with it… I, with my Commodore VIC-20, would be the latter. Don’t get me wrong, I would buy a Datsun 240Z in heartbeat (because it’s the coolest looking car since, like, ever!) if I thought my wife wouldn’t have my head keep on rolling after 240Z stopped in the driveway. I digress…

My VIC-20 did not come with any extras, no cords, no adapters, no drives, nuthin! Meh, what can you expect for $20? I certainly did not expect that it came with a manual, so kudos to the previous owner for that. All I had was the knowledge that the machine was in good shape and that it did work the last time it was tested, whenever that was. That was fine, because I primarily purchased it so that it could grace my desk with its retrotastic presence. However, I did want to see if it worked and if it did, I would eventually get some stuff to use with it (ultimately, I would like to get a Commodore 128 to retrocompute upon).

The first thing I needed to do was scour my house and find two “wall wart” power adapters that could provide the (5VDC/1.5A) and (9VAC/1A), as they can be combined to provide the power that the VIC20 requires. This is by far the easiest and cheapest way to power a VIC20 or C64 if you have a fair amount of tech junk kicking around. I had all but given up on scrounging the 5V when I decided to take a closer look at the broken adapter (kids broke the USB connection) for my Blackberry Playbook, because my old eyes really were able to make out if it was 1.0A or 1.8A written on in super tiny letters and I none of my other adapters have enough amperage. Sure enough, it was 1.8A. Combined with the 9V supply from one of old Lynksys routers, I had the power!

As part of my initial research, I looked at purchasing a 7 pin DIN connector for power plug, but I couldn’t find any locally and the ones I found online tended to have crazy shipping prices. $2 for the item with $20 for shipping does not make any sense, Mouser.com… My experience with buying very inexpensive, yet high quality components from China on Ebay has been great, apart from the whole “slow boat from China” aspect of the shipping, so I will probably go that route in the long term. In the mean time, decided to test the VIC-20 using some hand built DIN pins.

he following is a series of pictures and steps demonstrating how I crafted a plug for the Linkysys adapter (rather than wreaking it), the pins for the power and video cables, and how I attached them to the machine.

Creating a Plug for the Linksys Adapter
1. Get spare piece of mutli-conductor wire. This is from an old PC power supply.
2. Use wire cutters to cut the insulation a few inches from the end.
3. Slide the shielding down, exposing a gap in center.
4. Bend the wire over the outside, ground part of the plug.
5. Use a zip tie to hold the loop closed.
6. Remove the power plug, tin the loop with solder so that it holds its shape, and outer part is finished.
7. Take another piece of wire and strip an inch of insulator from it.
8. Fold the exposed wire over on itself and twist it together tightly with your finger. This will is the center post of the plug.
9. Twist the center post some more with some pliers to make sure it is strong, then slide it into the hole on the adapter to make sure it fits. If it is too large, squish it a bit with some pliers. If it is still to larger, use a lower gauge wire or start over and trim some of the strands off this wire before bending it over.
10. Tin the center post with solder and make sure it still fits inside the plug’s hole (squish and shape with pliers as needed).
11. Slide the plug into the wire loop, stick the center post into the plug, and use a zip tie to attach the center post to the loop.
12. Wrap in everything together in electrical tape, being careful to not leave any exposed metal.

Making the Connecting Pins
1. Find some spare bits of copper grounding wire from 120V home wiring. I used two gauges, with the slightly smaller one being used for the video cable.
2. Cut six 1.5″ pieces and remove any insulation.
3. Use a hammer and a solid surface, such as an anvil or other heavy piece of metal, to slightly flatten 1/4″ on the end of each pin. This makes it easier to solder the wires to the pins.
4. Sand or scrape off any corrosion on the flat part of the pins.
5. Tin the pins and the wires and solder them together. You will need to hold the pins with a clamp of some sort, as they get burning hot in an instant!
6. When the pins have cooled down, slide some wire-shrink over them and the wires and shrink it (using heat).
7. Mark the ground on the 5V pin differently so that you can remember which is positive and which is ground.

Making the Video Cable
1. Cut the end off an RCA cable.
2. Solder the pins, as above.

Connecting the Pins to the VIC-20
Normally one does not have to deal with pins when plugging in a cable, but the reality is that many connectors are stuffed full of pins and it’s those pins that are doing the real work. With that in mind, if we know what pin goes where, it’s not a big deal to simply slide the pins in one at a time by ourselves. Here is a diagram of the Commodore 64 / VIC-20 power supply:

Keep in mind that the picture of the socket on the bottom left is what you see when looking at the VIC-20, while the circle on the bottom right is what the 7 pin DIN connector on the end of a standard power cable would look like if you were holding in your hand. When manually inserting the pins, it easiest to just refer to the numbers on the socket.

The two 9V pins slide into the top most holes. The 5V ground slides into the bottom middle, while the 5V positive slides into the number five hole immediately to the left of the bottom middle hole.

Connecting the video cable is just as simple. Here is the layout of the video socket, as you would see it when looking at the back of the VIC-20:

Slide the ground pin into ground and the center “signal” pin to hole 4, then connect the other end to the composite in of the TV, monitor, etc. that you will be displaying the VIC’s upon.


And now for the “pre-flight check”, where I opened up my VIC-20 to make sure nothing had been living it, etc.

And the setup, using the composite in on the TV tuner in my PC as a monitor…

And the big reveal!

It works!

And with that accomplished, it’s time to find at least a “Datasette” for it so that I can save and load programs, because the VIC-20 is not so useful without that capability. I am probably better off to use the emulator for now, with the VIC-20 keyboard as a visual aid. I am not sure which is harder, typing on the real and unfamiliar VIC-20 keyboard or trying to figure out what key does what on my PC keyboard when using the emulator… 🙂

Typing in a BASIC program from the manual (left) and running it beside the emulator (right).

What a nerd am I! lol…

VIC-20: Walking Before It Runs

Through my ongoing research into getting my used Commodore VIC-20 working, I have made some progress towards getting it running while spending as little money on it as possible. My $20 VIC-20 came with only the “breadbox” computer and the manual, meaning that in order to fire it up, I need to obtain an AV cable, a monitor/TV, and a power supply. If I want to load any software on it, I will also need a disk drive or a tape deck or a cartridge. As of today I have the following…

Power Supply
– A 9v AC adaptor (from a Linksys router) to use in the creation of a power supply. Despite reading the specs on every “wall wart” AC adaptor in the house, I wasn’t able to find one that outputs 5v at the minimum of 1.5A (I have several at 1 amp, but that’s not really enough to run the VIC-20). Looks like I will need to buy a 7 pin DIN connector and a 5v adaptor so I can wire them together to form a modern, inexpensive power supply.

Monitor
– I setup the video input on my KWorld PC150-U TV Tuner to work with the TVTime software and tested the composite input using a busted DVD player. This should allow me to run the VIC-20 in a window on my main PC monitor! This is probably not an ideal setup, but it does have the advantages of already being paid for and not taking up more room on in my limited desk area. I haven’t used the video inputs on the tuner for years, so it’s nice to know it still works (I generally just use the RCA inputs for audio recording).


Next Steps
– Obtain a 5 pin and a 7 pin DIN connector, as well as a 5v DC 2A adaptor so I can assembly a power supply and a video cable.
– Open up the case to make sure everything is OK before powering it up for the first time in forever. The previous owner stated that it did work the last time it was tested, but I don’t know how many years ago that was.

The Bigger Picture
– I’ll be re-learning Commodore BASIC and the assembly language for the C64, using the VICE emulator, thanks to these great books!
– When I start an actual programming project (a game, of course, some time after I finish RocketTux), I will be writing the BASIC code in Linux and converting it to a native c64 program using C64List, because this will allow me to use Git/GitHub version control system (on the plain text BASIC file). This is ideal from a workflow perspective, but it’s not really what I would consider “retro computing”. Ideally, I would like to get a Commodore 128 or a Commodore 64C, a disk drive, and something that allows me to share data with the PC.
– I have decided that I want to keep my VIC-20 in its natural state, but I would like to get some extra stuff for it, such as a RAM expansion cartridge and a few cartridge games. I might “retrobrite” it, because it has inconsistently yellowed over time, but it’s not super high on my list of priorities.

Well, that’s where I am at right now. Actually, this…

is where I am at right now – my refurbished desk area! Why purple? We had 2/3 of a can left over from when we painted our kid’s room years ago, so I figured what the heck – it wasn’t going to be used for anything else and I like purple more than ratty old beige. I’m thinking it would be fun to make some clear plastic shelves for the right side, complete with a breadboard Arduino LED system, because why not! 🙂

I Bought a Commodore VIC 20 for $20!

Over the past couple months I have been chatting with my friend, Kinshi, about his retro computing hobby and it got me into the spirit as well. The first computer I programmed on (in 1993 or so) was the Commodore 64 in our grade seven class room. While I was given a Commodore 64 around the same time too, I didn’t end up doing a whole heck of a lot with computers until 1998. None the less, I ended up with a soft spot in my heart for the o’l “breadbox” machine. Watch me as I head off on a journey to buy my very own Commodore VIC 20!