Wednesday, February 8, 2012

Setting up the Environment

Sadly there isn't a GB IDE. Irregardless, that doesn't mean we can't create a pseudo IDE. Don't worry, there's no coding involved.

This step is primarily for Windows as that is the OS I'm using. If you are using Linux, follow this. It's from the website of the development kit we'll be using.

First go to this website. This will link you to the Game Boy Development Kit. This kit is essential for creating game boy games. Follow the directions for getting it to work. For windows users, just extract the thing in the root folder (C:\) so the path to the GBDK will be C:\GBDK. There are some sample roms in there that just need to be compiled. After being compiled, you can then run them on an emulator. This emulator is BGB. It's a pretty good emulator with a debugger which is really valuable for development. For linux users, the emulator of choice would be this (at least for Ubuntu. Hopefully though it will work with other versions of Linux. Feel free to search the web for another emulator though. I will be. If you happen to come across one, link it in the comment section).

Now that we have the GBDK in the root directory, you'd probably want to compile those samples so that you can see what they do. Just copy and paste this in the MAKEFILE for each of the following samples:

DSCAN
 ..\..\..\bin\lcc -Wa-l -c -o dscan.o dscan.c
..\..\..\bin\lcc -Wl-m -Wl-yp0x143=0x80 -o dscan.gb dscan.o

The other MAKEFILE doesn't need to be altered at all. Just double click it and they will compile right before your very eyes.

Now download Crimson Editor. Crimson Editor is an all purpose editor. It's pretty simple to use and to configure. After you download it, install it, create desktop shortcut,and then run it as Adminstrator:

FOR VISTA/7
Right Click on Crimson Editor
    Select Run as Administrator
        In the Dialog Box that pops up, click OK

FOR XP AND BELOW
    
    1.In Windows Explorer, click the program executable file that you want to open.
2.Press SHIFT and hold, right-click the program icon, and then click Run as.
3.To log on using an Administrator account, click The following user.
4.In User name and Password, type the Administrator account name and password that you want to use.

One you're in Crimson Editor, go to Tools->Preferences. A dialog box will pop up. In the left window pane, go to where it says, User Tools (should be at the bottom). Here we can now link the GBDK compiler to Crimson Editor. Select the first blank command next to Ctrl-1. In the Menu Text box, name it something relative to compiling GB Roms. The box below should say Command. Right of the text box is a browse button. Click on that and then navigate to the GBDK, then bin, and finally lcc. LCC is the name of the gb compiler.  Under neath that, is a text box labeled Argument. Right of the text field is an arrow. Click that arrow and select File Name. Under neath that is Initial Dir. To the right of that is another arrow. Click that arrow and choose File Directory. Lastly, underneath all of that, there should be a checkbox next to Capture on Output. Make sure you check that.

The Final Product should look something like this:
*Note: The directories holding the gbdk doesn't need to be titled as I have titled it. Just so long as it's in C:\, then all should be ok*

Now we have successfully set up a development environment that will allows us to save our code in any folder that we please. The only downside to using this method is that your roms won't be named what you named your source code, so it is advised to keep your projects in separate folders and named what they are. After you've tested them and find that they work well, you can rename them to whatever you please.

That ends that. Now we have our environment setup so we can begin making GB roms.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home