Top-Notch Gameboy Advance Accessories!
Highlights
Complete development kit for the Gameboy Advance by Ngine. Sprites, tiles, GBA monitor and etc. Find it hereVisualBoyAdvance GameBoy Advance emulator. Fast and stable with great compatibility. Find it here
Navigation
News
Tutorials
Tools
Demos
Sources
Links
Statistics
Visitors: 012980
Date: 21 Nov 2008
Web Ring
Browse: Prev Next
Ring: Hub Join Ring
Design & Copyright 2002 Sergej Kravcenko
27 Mar 2002, Wednesday
    Preface

    With this volume I'm starting new GameBoy Advance development tutorial series. I'll try to cover all GameBoy Advance development aspects including graphics, sound, interrupts, DMA, timers and much more. Every tutorial will contain code examples with informative comments.
    Grab GameBoy Advance, development tool, your imagination and join wonderful GameBoy Advance world.

    1. Hardware. Overview of the system.

    Let's review major parameters of the GameBoy Advance system:

* 32-bit RISC CPU ARM7TDMI
* 16.78 MHz processing frequency
* System ROM 16Kbytes
* Working RAM 32KB + 256KB
* Video RAM 96KB
* Game Pack Memory up to 32MB
* 240 x 160 screen resolution, up to 32768 colors
* Hardware video effects (rotation, blending, mosaic)
* 6 control keys and Direction Pad
* 4 + 2 sound channels
* Serial communication

    Time to examine these parameters. 32 RISC CPU at 16.78MHz gives us quite good processing speed. You can say - What? Only 16 MHz? My 10 years old computer had same speed (for example Amiga 1200 had 14Mhz Motorola 68020 CPU). But, GameBoy Advance CPU designed with RISC technology, this means from 2 up to 5 times faster instruction execution speed. Another reason of such small frequency is power consumption.
    CPU has two operating modes: Arm and Thumb. In Arm mode all CPU instruction have 32bit length and 16bit length in Thumb mode. CPU can be switched from one mode to another at any time. In future tutorials I will explain what is the difference between those two modes and how they affects program performance.
    Built in memory mostly used for program variables and dynamic data. 32KB RAM block has fastest accessing speed and connected to CPU with 32bit bus. 256KB RAM block has 2 cycles accessing delay and connected to CPU with 16bit bus. If possible store all your program variables to fastest 32KB RAM block.
    Game cartridges contain Game Pack Memory. Here we have enough space (up to 32MB) to store all game data and code. Game Pack Memory connected to CPU with 16bit bus. Also every cartridge contains Flash memory to store game saves.
    Most advanced component of GameBoy Advance is video system. It is very optimized for 2d graphics game engines and have almost all hardware-accelerated function required for such games: sprites, 6 video modes, rotation/scaling, alpha blending, fade-in/out, mosaic. Unfortunately this video system doesn't support any 3d acceleration functions. 
    Sound hardware is compatible with GameBoy/GameBoy Color. Additionally GameBoy Advance contains 2 DirectSound (don't mix with Microsoft DirectX DirectSound) channels and can playback 8bit raw audio data.

    2. Development systems.

    You can create program using hex editor, but I don't think that you will be able to do something serious going this way. I suggest you to take C/C++ compiler for practicing purposes. Later you can rewrite code parts in Assembler, if you really need to do so.
    There are two C/C++ compilers for GameBoy Advance: ARM SDT and GCC. Personally I prefer ARM SDT, but it requires commercial license and only available to professional developers. If you are freelance developer and don't have spare $5k for ARM SDT licensing, then get GCC compiler because it is free. GCC compiler is distributed under GNU license.
    There is very good "Unofficial GameBoy Advance Software Development Kit". You can find it here.

    3. Setting up the development system

    Lets make a list of required items:

* C/C++ compiler
* Gfx/Tile/Sprite editors
* Header editor
* Source editor
* GameBoy Advance, MBV cable, Flash Cart
* GameBoy Advance emulator

    Ok, so many items. Let's check one by one. All about C/C++ compiler you can read in previous chapter. I think you have already downloaded and installed "Unofficial GameBoy Advance Software Development Kit". Make sure that GCC bin directory added to your PATH variable. Open command prompt and type "gcc", you should get following message "gcc: No input files".  
    Graphics tools. There are many graphics editors around the web. Minimal requirements are PhotoShop or PaintShopPro, Kaleid, Chili and AGBGFXConverter.
    Header editor. Each ROM image has standard header defined by Nintendo. Using header editor you can change ROM image header information.
    Source editor. Take any editor that supports syntax highlighting. I recommend Microsoft Visual Studio 6.0 because it puts your source files into one project. This really helps if you have very big project.
    Hardware. Obviously, you need a GBA. You can use emulators instead of real hardware, but I strongly recommend purchase GameBoy Advance and Flash Linker with at least 64MB flash cart.

    4. Checking development system

    Compiler downloaded and installed, Flash Linker connected, what next? Download this small example project and check that your system configured correctly. It must compile without any errors, just click on make.bat file. Program will be compiled and linked to output file Example1.bin. Take this file, write it to Flash Cart or simply load into emulator. This simple example fills screen with red color.

Sergej Kravcenko
sergej@codewaves.com