Author Archives: admin

Static Recompilation of CHIP-8 Programs

Screenshot of “UFO.ch8” running natively in a terminal

Static Recompliation” is the process of turning a binary program built for one instruction set and CPU into equivalent native code for a different architecture. It’s a hot topic lately as news of a static recompilation process for N64 games – turning the original MIPS code into x86 executables for Windows – seemingly promises an entirely new level of features and performance beyond existing emulation techniques. I’ve been interested in the topic since hearing of the StarCraft on ARM recompilation for OpenPandora in 2014, but not looked too much further into the idea until recently. I decided to try my own hand at a static recompiler, where I would be transforming some machine ROM into C source code, then compile that to produce native executables.

First, I’d need a source system to use: The CHIP-8 VM, often considered a good “baby’s first emulator” project. It is an interpreted 8-bit machine, with only 30 opcodes or so, limited graphics and sound capabilities and a lot of tooling available. I began by spending a couple of days implementing the machine in C as a plain “interpreted” emulator, using libcurses to handle keyboard input and display visuals on the terminal. This was useful for getting a feel for the machine, learning about quirks and addressing modes, as well as a benchmarking test. Some of the routines for interfacing the VM with the real hardware (e.g. “print screen”, “check keypress” etc) are theoretically reusable in a recompiled version as well. CHIP-8 emulation is a well-studied topic, I won’t say much more about it here.

With that complete, I turned my attention to the recompilation. If you’d like to see the code I wrote, I’ve placed it in GitHub here:

https://github.com/greg-kennedy/CURSE-8

Inside are the interpreter, and a Perl script “recompile.pl” which turns a .ch8 file into a .c. Compiling this along with “wrapper.c” and linking to libcurses should give a runnable executable of the chip8 program.

Details of approaches to static recompilation follow.

Continue reading

Scrabble CD-ROM Word Lists

Screenshot of Scrabble 1.0 showing an easter egg: searching the dictionary for "FEINBERG" which returns the text "FEINBERG JIM: Karting fool. Or is that fool karting? Special thanks to Allen "The Fudge Man", Matt, Marilyn and Ceaser Feinberg. Go Ernie! RIP Friskie.

Hasbro’s Em@il Games Scrabble does not come with a dictionary. Instead, checking words for validity is done by the server, and only when a player challenges a play. This was probably for a few reasons – reducing the client download size, allowing Hasbro to update it as needed, and as a safeguard to keep the word list out of public circulation.

This means I need to provide my own dictionary for Hasbro PBEM Proxy to support the game. It seemed a simple enough problem: just get a word list from somewhere, and hook it up. But which one? I started by using CSW21, the latest (at the time) list of competitively accepted words. Yet this bothered me as it seems anachronistic: the game released on Feb. 5, 1999, so shouldn’t the word list be equally contemporary?

Thus begins another great (and probably foolish) journey into software archaeology. “What dictionary were people using in 1999?” turns out to be a complicated question, due to the fact that different lists were used for casual vs tournament play, US vs UK, short vs long words, etc. and unification of these was not really a priority at the time. Plus, some of the word lists remain unavailable unless you were a paying member of NASPA or another Scrabble professional organization. Besides, even if I had the word lists, is there any certainty that those were the ones backing the Em@il Games service?

I decided to try a different approach. Presumably, Hasbro had provided the dictionary to the developers that they wanted to be used. It makes sense that they would use the same dictionary in other branded Scrabble products at the time. In 1996 Random Games and Hasbro released a version of Scrabble on CD-ROM, helmed by lead developer Brian Sheppard (who had independently created a top performing shareware Scrabble AI called “Maven” two years before, and been hired by Hasbro to run this project — after discontinuing his own version, of course!) Three years later, “Scrabble Version 2.0” came out, with a complete redesign of the UI and a higher resolution gameplay. This version did not run well on Windows XP, so in 2002 Hasbro released “Scrabble Complete”, a slight rebuild of 2.0 with XP support and a few new background images.

As these products neatly bracket the release of Em@il Games Scrabble, I sought to get the word lists from each, and see how they stacked up to dictionaries in use.

Continue reading

University of Arkansas Game Development Club

UAGDC logo

Some years ago I posted about my half-baked MMORPG idea, “GregerQuest”, and mentioned towards the end that I later worked on another hobby MMO called Draconis. This was a project of the long-deceased University of Arkansas Game Development Club – a student-run organization for people interested in making games. I put a thread on Twitter about my experiences with the club, but I’ve decided to repost it here as well for later reference.

From 2004 to 2006 I helped run the University of Arkansas Game Dev Club with co-founders Steven Silvey and Kenny Cason, and faculty sponsor Bill Johnston. It continued on until ~2008 or so, after many of us graduated and membership dwindled away. Here was what our webpage looked like. Project hosting and the forums were popular areas. Web space was provided by the UARK servers – 100mb for a club, iirc, a luxury! – and the first web design was table-based and constructed using MS Paint by yours truly 🙂

Meetings were held in the CAST computer lab in Ozark Hall, normally used for people doing “real” 3d modeling and geospatial / GIS mapping stuff. But they had a projector and some nice computers and so every 2 weeks in the evening we’d run a meeting, usually a couple hours long. The first meeting attracted several dozens of people, mostly due to us footing the bill at U.S. Pizza, but there were maybe 8-10 regulars who showed up in the later sessions even when there was no free food offered.

Photo of the CAST lab – though more recent, as the projector and old Dell Optiplex + CRT monitors are gone

The first part was student-led presentations of a game dev topic: IDEs, frameworks like SDL and Allegro, some discussion of modeling with SoftImage, etc. I recall Steven showing some tricks for making better programmer art, and composing MIDI files using a simple DAW-type app. I may have demoed booting Gamecube homebrew using the PSO exploit. We even had a quaternions lecture… which, of course, I remember nothing about. The rest of the evening was used for collaborative time for projects.

Continue reading

Identifying Playstation Cracktro Soundtracks

Screenshot from Paradox Klassix – Soul Reaver (ITA) cracktro

A user in the Nectarine Discord brought an interesting question recently: they had some Youtube videos of cracktros from Playstation games, and wanted to know if anyone could identify their soundtracks. For those unaware, a “cracktro” is a combination of a “crack” (piracy) and an “intro” (demoscene) – it’s a little movie or menu that plays at the start of a hacked / pirated game, usually with credits and simple visual effects. It’s a calling card from the group who helped pirate the game, often with “greetz” to the supplier of the disc image, the coder who cracked it, the BBS or site who re-hosted the result, etc.

Cracktro soundtracks are usually an oldschool chiptune or lo-fi soundtrack in “module” format. Originally created on the Amiga computer, .mod audio files are very small, similar to a MIDI with bundled sound samples. They are well-suited to cramming into a tiny executable, which must fit on the CD along with the pirated game. Sometimes the musician gets credited, but other times it’s a mystery. MOD files don’t have a place to write the artist or other info, only the title and instrument names. Because of the unknown provenance of the files, ripped from games or BBS posts or musicdisks full of sounds, sometimes the original credits are lost or incorrect.

Back to the Playstation games. There was a short list of videos that needed help to track them down, but eventually we got them all figured out. Every one of these was from the group “Paradox”, a console cracking and piracy group who released a number of titles in the early 2000s. Here’s how we figured them all out:

Continue reading

Discord Minesweeper

Discord Minesweeper is a Perl script I wrote that builds on one of my previous projects, WebService::Discord::Webhook. It generates Minesweeper boards and posts them to a Discord channel. Each square contains a bomb, number, or blank space, made using the Emoji images. Using Discord’s “spoiler” tag (wrapping text in double pipes, ||like this||), the squares can be individually uncovered, thus making a playable game without even leaving chat.

The code is available on GitHub here: https://github.com/greg-kennedy/Discord-Minesweeper

I ran this script for a few months, posting one board a night, but users eventually got sick of it and deleted the webhook… well, perhaps there are other games that could be done this way? I think a Blackjack simulation would work: you are dealt some face-up cards, optionally some more (covered) to flip, and once you’re finished you can reveal the dealer’s hand to see who won.