Howto: Convert a K6-2 into a C64

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

This came about when I saw the X-Amiga thread on the forums, and saw screenshots (of the installer, anyway) for that distro — one that more or less defaults straight to a pseudo-Amiga environment.

What if, I thought, you could boot straight into VICE, with no visible window manager and with very few traces of Linux underneath that? Maybe it would look like …

That’s Gutsy there, with a couple of subtle tricks happening. First of all, that’s Openbox controlling the VICE window and terminal screen you see. The root window (the wallpaper, that is) is set to match the VICE bracket around the C64 porthole.

After that, it becomes a trick of fonts and theming. The Openbox theme is stripped of the border setting, so there’s no visible box around any of the windows. The colors match the screen output given via gcolor2, so the terminal and the menu selections match the old blue color of the default background. And so forth and so on.

Another small obstacle: As far as I can tell, and I spent an hour or so searching, Openbox has no way of triggering an undecorated window at its inception. You can center windows by default through the new ObConf, but you can’t force them to appear undecorated. Once they’re on screen you can undecorate them manually, but not as they’re spawned.

In that sense, it might have been ideal to go window manager-less, but that causes another problem — X doesn’t seem to have a provision for spawning applications anywhere but in the upper left corner. And without a window manager, you can’t easily move windows around the screen. So it was a bit of a Catch-22: I could spawn borderless windows, but only in the upper left corner; or I could spawn windows that were centered, but came with frames.

To solve both of those problems, I used the aptly named devilspie. By running it when X starts, and telling it to catch VICE when it pops up, you can strip the emulator of its borders and force it to the center of the screen — killing two birds with one stone.

To do something like this, set up a command-line installation of Ubuntu, and add xorg and Openbox. Add or subtract whatever packages you like, basically setting up the system as you see fit. I added almost nothing, using only rxvt-unicode and a few fundamental additions to Openbox.

(If you do build this on a command-line installation, it helps to set up an autologin executable and to trigger startx on login. Just so you don’t have to keep logging in and typing that command. ;) )

After that, install VICE, either from the repositories or from scratch (I strongly recommend installing from scratch). Set VICE to start up in double size, and save those settings.

Then get devilspie from the repositories, and create a .devilspie folder in your home directory. Make a file inside called C64.ds, and put this in it.

(if (is (application_name) "C64") (begin (center) (undecorate)))

That’s all. Save and close.

Next, open your .xinitrc file, and make it look something like this.

xsetroot -solid "#cecece"
devilspie &
x64 &
exec openbox

#CECECE is the hex code for the color of the VICE bracket. Matching the root window to that bracket gives the illusion that the emulator is anchored seamlessly to the root window, even if it’s still floating.

x64 is the trigger for the emulator, but notice that the application name — the title that devilspie needs to catch — is C64: That’s why it’s in the configuration line for devilspie. And of course, the last line passes control to Openbox.

Update: Thanks to billy for pointing out how to do this in Openbox, without using devilspie. (It figures: I comb the Web for an hour, trying to figure out how to spawn undecorated windows, and all the time it’s right under my nose. …)

Inside your ~/.config/openbox/rc.xml file, near the bottom, there’s a section called “applications.” Ordinarily it’s commented out, so modifying that part of the file won’t have any effect. Remove the leading comment markers (it looks like greater-than-exclamation point-dash-dash), and the trailing one as well (same, but without an exclamation point).

Then adjust it to say this.

  <application name="C64">
    <decor>no</decor>
    <shade>no</shade>
    <position>
      <x>center</x>
      <y>center</y>
    </position>
    <focus>yes</focus>
    <desktop>1</desktop>
    <head>0</head>
    # specifies xinerama head
    <layer>normal</layer>
    # 'above', 'normal', or 'below'
    <iconic>no</iconic>
    <skip_pager>no</skip_pager>
    <skip_taskbar>no</skip_taskbar>
    <fullscreen>no</fullscreen>
    <maximized>false</maximized>
    # 'Horizontal', 'Vertical' or boolean (yes/no/on/off/true/false)
  </application>

You can modify those settings as you like, putting it on certain desktops, heads, etc. You’ll need to restart (not reconfigure) Openbox if you want them to take effect immediately. Note that those settings will apply any time you start x64, either at startup or from elsewhere.

Now if you want icing on the cake, you can use the Adore64 font on FreakyFonts.de for the urxvt console font, Openbox window font and GTK2 font. (Again, Openbox will need restarted — not reconfigured — for that font to take effect. I don’t know why, but it did for me.)

Setting up urxvt is fairly easy; add these lines to your .Xdefaults file.

urxvt.font: xft:Adore64:autohint=false:antialias=false:size=6
urxvt.background: #3a319c
urxvt.foreground: #7b71d6
urxvt.scrollBar: false
urxvt.cursorBlink: true
urxvt.geometry: 40x25

Those hex codes, again, match the startup light blue and blue presented by VICE. Use that Adore64 font at sizes that at multiples of 6 — odd sizes get antialiased, which makes it smear. Avoid the bold effects too, since they also cause visual problems. The geometry sets the window to the C64-ish 40×25, and the cursor blink is … well, you know what that’s for.

If you want, I’ve put together an C64-Openbox Theme that mimics the colors and font of the C64 startup screen. It’s not fantastic, but it is a starting point if you’re a heavy-duty themer. Remember that you’ll have to rename that file to an .obt extension (because of WordPress.com’s lame filename extension requirements), but then you should be able to install it through ObConf.

For a GTK2 theme I’d suggest Rezlooks-royale, which is fairly close to the C64′s blue shades. If you find yourself using many GTK2 applications, you might tweak those colors to be closer to the “real thing.”

What you add above and beyond that will depend on how much function or access you need. If you want to be able to surf for disk images you’ll need a browser of some sort, and you might want a file manager. For my own purposes I was content to stick with wget and console commands.

Overall, it’s a gimmick, but kind of a kick. If you still spend your spare time playing Jumpman and Bruce Lee, like I do, you’ll have a bit of fun setting it up.

P.S.: devilspie is a really cool utility that has a lot of potential. For more ideas on how to use it, check these threads and sites.

How To Set Default Workspace, Size and Window Effects in Gnome
post your devilspie config files with screenshot
Devilspie (version 0.13 and greater) s-expressions examples

And if you just want to set up a terminal with the classic C64 font, you might prefer to use the BDF font posted on this page.

About these ads

10 Responses to “Howto: Convert a K6-2 into a C64”


  1. 1 billy 2007/11/16 at 10:37 AM

    You can have undecorated windows. Add this to your rc.xml to remove all decorations:

    no

    Or replace * by the application name you want to remain undecorated

  2. 2 billy 2007/11/16 at 10:39 AM

    Hmm that didn’t show up…

    (applications)
    (application class=”*”)
    (decor)no(/decor)
    (/application)

    Replace the ( by and it should work.

  3. 3 billy 2007/11/16 at 10:41 AM

    Silly codes… The brackets should be replaced by those pointy (<) ones (whatever they are called).

  4. 4 K.Mandla 2007/11/16 at 11:31 AM

    Thanks, I’ll give that a try. It might be easier than installing devilspie and configuring it. ;)

  5. 5 K.Mandla 2007/11/16 at 10:39 PM

    That worked for me, after a little bit of tweaking. I’ll update that as an alternative to using devilspie. Thanks! :D

  6. 6 billy 2007/11/17 at 12:09 AM

    The ‘applications’ section in Openbox’s rc.xml is capable of a lot. It remains hidden for most users, as it isn’t supported (yet?) in Obconf, but the Openbox site has a good guide for it (http://icculus.org/openbox/index.php/Help:Applications)

  7. 7 Methanoid 2007/11/22 at 6:52 AM

    How about packaging like X-Amiga did and releasing to the world? Or an easy installer or something?

  8. 8 K.Mandla 2007/11/22 at 11:32 AM

    Oh geez. I don’t know if I want to get into that. I suppose I could bash script all that stuff together, but I don’t know. … :|


  1. 1 Toward a better C64 terminal « Motho ke motho ka botho Trackback on 2007/11/27 at 11:03 AM
  2. 2 Linux does C64 does Unix « Motho ke motho ka botho Trackback on 2011/02/08 at 10:50 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,961,544 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: