Tuesday, April 5, 2011

Classic arcade (and console) game source code projects

For a while now I have been trying to create the Definitive Galaga Dis-assembly Listing. Naturally I took an interest as to whether anyone had attempted any such similarly pointless and futile endeavor. I posted the initial versions of the code some time ago, but it was very rough. However, I am gratified that it has been noticed by at least a few people.

My reference links for similar projects::

Atari 7800 Source Code and Tool Archives (straight from the dumpsters at Atari!)

Donkey Kong Source Code (for 8-bit Atari comp?) posted by Curt Vendel.

Tempest (found in AtariAge forum)

Commented dis-assemblies of Pacman/MsPacman (go to "Video Game Links")

Analysis of Galaga Sound CPU.

Computer Archeology - lots of info on Galaga and several others.

Pacman Galaga Donkey Kong and several others..

Porting Qbert to GameBoy - no source but interesting commentary.

Boulderdash info by Peter Broadribb now hosted by Maarten Egmond. Not so much source code as much as it is a technical specification (reverse-engineered of course!)

Pacman Documentation.

Bombjack... on Spritesmind, a great reference source for the Sega MegaDrive.

Even those works based on the lowly Atari 2600 VCS are worthy of honor... Here is the Definitive Combat Dis-assembly Listing on AtariAge.

Pac-Man a tribute project.

Friday, April 1, 2011

Code::Blocks Setup

I am a big fan of Code::Blocks IDE, but had only discovered it about a year ago when I started messing around with MAME again, and was looking for a modern GUI front-end for the GNU debugger.

CodeBlocks is an IDE available for Windoze, *NIX, or MAC and released under GPL3. It apparently can support a bunch of different development environments but I have only used it with GNU'ish tool chains, particularly gcc on Linux or MingGW-gcc on WinXP.

CB has its own project manager for building and debugging - however, it can also launch builds which are handled by an external makefile. I chose the latter approach to get started quickly with Mame (it is not a trivial build to setup!) and have continued this way since. In the steps below I will go through the basic setup of the tools and the execution of a command line build, and then proceed to using CodeBlocks to build and debug with gdb.


Outline...
Downloads:
MinGW binary (Mame tools release).
Mame136 Source.
Command line build: follow instructions to do it the easy way.
(Note: I use the Cygwin shell, but need to add the MinGW installed PATH to my environment in order to call MinGW gcc and not the Cygwin gcc. I also include the path to the libexec, but I don't recall the exact reason or reference for doing so... but it works!). However, I don't care to make this a permanent environment change so I just put the following in a script which I "source" (dot operator) into my currently running shell instance:

export PATH=/cygdrive/c/MinGW/bin/:/cygdrive/c/MinGW/libexec/gcc/i686-w64-mingw32/4.4.3/:$PATHAt this point, it should be possible to build Mame from the command line to prove that the tool chain works. DEBUG turns on the internal Mame debug console, and Symbols basically enables the -g option to gcc to enable generation of the symbol table for gdb:
make DEBUG=y SYMBOLS=y emulator

Another useful option is to build the "tiny" configuration, which enables just a handful of drivers and significantly reduces the size of the executable:

make SUBTARGET=tiny DEBUG=y SYMBOLS=y emulator

I may eventually get around to describing the setup for a "tiny" build.
CodeBlocks setup:
Go to tools setup, where you can create a new toolchain configuration, or use, modify, or copy one of the many existing ones. For Windoze/MingGW, I chose to modify the existing "GNU GCC Compiler" tool profile, and simply to change the path to point to my installed MinGW.

Under "Settings/Compiler and Debugger/" and "Toolchain executables" tab:
Set the compilers installation directory to that containing the "bin" of the installed MinGW tool chain (mine lives in c:\MinGW).

The rest of the build configuration is setup by the project file:
Setup name of external makefile to call.
Set name of executable.
Set Build options Make commands.


In case of problems, there may be some helpful hints in this article.

This article may take a few editing sessions to complete so stay tuned...