How to get started programming for the GAMEBOY!
Have you ever dreamed of becomming a game programmer? Today is your lucky
day, becuase if you go through the following steps. I bet your can be making
gameboy games in less than an hour, and that is if your modem is slow. By the
time you finish reading this page you will have the basics that will enable you
to build homebrewn games that will give give professional developers a run for
their money. (
well maybe not professional developers, but its a
start!)
Note this tutorial is rather dated. It covers the original
gameboy, and not gameboy advance. For information about gameboy advance programming
click here.
Step I : Emulation
Get into Emulation, it Rulez! You will definetly need
to have a nice emulator for development. Even if you are lucky enough to have a
copier and
flash cartrige you will NOT
want to transfer everytime you do a build. So find a good emulator. The two
emulators I use are
GB98, and
NoCash. To find out the lasted in
emulation news visit
Zophar.
Step II : Be a Nerd, Be a Programmer
Learn C! You need to be able
to program to write Gameboy software, if you need help visit
CProgramming.com (which has lots of
tutorials) If you are ambitious enough there are several excellent
assemblers out there, but the Z80 opcodes are
quite a bit different than the good old x86.
Step III : Downloading/Installing/Setting Up the Compiler
Get the
GBDK (GameBoy Development Kit) by Pascal
Felber. The download site is located at SourceForge.Net, you will need to go to
this page
http://sourceforge.net/project/showfiles.php?group_id=1249
and then scroll down to the Windows binaries. The file name of the write one is
gbdk-2.95-3-win32.zip It is around 950k. It lets you build roms from C
code. To install the GBDK you will need to unzip it so that the GBDK directory
is right off the root (e.g.
C:\GBDK) This is the most important step,
without the compiler you can't MAKE GAMES!
Now you are probably wondering about the power of this compiler. So let's
make a sample game, change your directory to C:\GBDK\EXAMPLES\GB\DSCAN.
Now you will need to edit the MAKE.BAT in this directory, load it up and any
editor (notepad) or dos edit, and add "..\" to the front of the two lines. It
should look like this
..\..\..\bin\lcc -Wa-l -c -o dscan.o dscan.c
..\..\..\bin\lcc -Wl-m -Wl-yp0x143=0x80 -o dscan.gb dscan.o
After you are done editing, run
MAKE. When your done their should
be a file
dscan.gb. Load this into your emulator and watch the magic. You
can really develop cool stuff with this compiler, eh? If you want to see more
examples, look in the
C:\GBDK\EXAMPLES\GB.
After seeing the power of the GBDK, you should add the following line to the
end of your autoexec.bat to compile your programs. Type it in right NOW!
path %path%;C:\GBDK\BIN
Step IV : Your first ROM, Wahoo!
Write and compile the following
program. Place it in a directory and give it the name
NEW.C
#include <gb/gb.h>
#include <stdio.h>
void main()
{
printf("Welcome to GAMEBOY\nProgramming");
printf("\nPress Start");
waitpad(J_START); // other keys are J_A, J_UP, J_SELECT, etc.
printf("\nIsn't it easy!");
}
Compile it (make a ROM) by typing the following at the command line
lcc -o new.gb new.c
(You need to have added C:\GBDK\BIN
to your path)
After that load up new.gb with an emulator and watch the magic. You just made
your first Gameboy ROM!
Step V : Developing the Skill
Write some cool programs! Spend all your
time writing games instead of playing them. For more tutorials on basic gameboy
programming visit
Gameboy Dev'rs.
It is a great resource.
Step VI : Enter the GRAPHiCS
Get the
Gameboy Tile Designer, and Map Builder. They
will build the graphics and sprites you will use in your game. For help using
these look through the GBDK samples. There is a lot of sample code out there.
Step VII : Keeping Up with the Scene
Now that your an accomplished
gameboy programmer, it might be a good idea to keep up with the scene. Here are
some of the most noteworthy sites out there.
Thanks for visiting our GameBoy programming page. If you get
bored or want to see something really cool then try our homepage http://www.loirak.com/