Compiling the source code:

1) this setup uses the freeware GCC C compiler.  Unlike my previous demo game, Blodrunner
   is set up to use the most recent version of the compiler, which is available at
   <http://www.io.com/~fenix/devkitadv/>.  Download the following files from the
   website:
	  Agb-win-core-r5.zip
	  Agb-win-binutils-r4
	  Agb-win-gcc-r4.zip
	  Agb-win-newlib-r4.zip
	  Agb-win-patch-r4.zip
   Unzip them into your root directory (usually c:), in the above order (click yes on
   any requests to overwrite existing files... some of the later zip files modify files
   in the previous zips).  This will create a directory called "c:\devkitadv" on your
   harddrive, which contains all the compiler stuff.

2) to compile the game, open a DOS command line shell.  Go in to the "blodrunner"
   directory (where you unzipped the source files), and type "setenv"...  This will run
   the "setenv.bat" batch file, which sets up all the DOS paths, making the assumption that
   the GCC files are at path "c:\devkitadv" (if you installed the devkitadv somewhere else,
   you need to change this batch file).  It also contains paths a tool directory
   (for gbarm.exe... you don't actually need this little tool if you will only be running
   the game on an emulator).

3) type "make" to build the game from the makefile.  This runs "make.exe," a tool included
   with the GCC compiler.

4) type "m" to make the final version... this makes the game (as in step 3), but then
   also runs the ROM image through a final tool that allows it to run on a physical
   GBA (gbaarm.exe)... the tool corrects the header information for the game.  The tool
   is a small freeware application you can find at one of the GBA websites (www.gbadev.org,
   or www.devrs.com).

Notes:
   The "src" directory has all the game code, the "asm" directory has a single assembly
   routine for integer division.  There is also a sub-directory in the src directory,
   which holds the game data files.

   I've created my own set of hardware labels and macros... I know this may confuse some
   people who usually use the standard "gba.h" hardware header file (see any of the pern
   project tutorials).  In fact, the hardware information is scattered across half a dozen
   header files (each with the name gba_???.h), depending on function.  I grabbed hardware
   stuff as I needed it, but I've been a game engineer for over a decade... I tried to
   keep everything organized and well commented!

Files:
   root directory
      makefile - the make commands used to build the game.
      setenv.bat - the batch file I use to init my DOS environment (sets the location of the compiler, etc)
      m.bat - makes the game and then fixes the ROM so it can run on actual GBA hardware.
      map.bat - a handy batch file for getting a map file of all the labels in the game and their location
                in the final game ROM.  It outputs "blod.map" as the map file, and "x.map" as a sorted version.
	  lnkscript - this is a linker script the GCC compiler uses to figure out where in memory all the code goes

   src directory
      gba hardware files:
         gba_disp.h      - core display mode file... headers for setting the display mode and related settings
         gba_buttons.h   - hardware info for the player buttons
         gba_bkg.h       - background tile map display headers
         gba_sprite.h    - sprite display headers
         gba_palette.h   - palette display headers
         gba_interrupt.h - interrupt setup (v-blank, etc)
         gba_dma.h       - DMA access
         gba_mem.h       - RAM memory locations
         gba_timer.h     - hardware timer access
         gba_backup.h    - info about the backup save RAM
         gba_sound.h     - sound hardware settings

      display files:
         background.h/.c - using background tile maps (mostly an init routine)
         sprite.h/.c     - sprite display (using a double buffered OAM table)
         vblank.h/.c     - code routine for the vertical blanking routine (downloading graphics to VRAM)

      engine files:
         main.c          - game startup code
         game.h/.c       - game init and main game loop
         world.h/.c      - game world setup
         buttons.h/.c    - code for reading and processing player controls
         interrupt.h/.c  - interrupt setup and jump table
         object.h/.c     - simple game object system
         text.h/.c       - simple text display, using sprites to display each character
         math.h/.c       - math routines (fixed point conversions, etc.)
         eramHeap.c/.h   - very simple memory allocation using external RAM
         collide.h/.c    - simple collision
         types.h         - defines the integer type labels I use (s32 for signed 32 bit integer, for example)
         dma.h           - macros for simple DMA access
         debug.c/.h      - console text display (useful for debugging on Mappy and other emulators)

      game objects:
         dude.h/.c       - code for the people characters (both player and computer controlled)
         bullet.h/.c     - player bullet sprite objects
         powerup.h/.c    - code for the powerups

      game data:
         dat.h/.c        - core data file and headers (includes all files in the data directory)

      src\data directory
         bkgDat.c        - tiles and tile maps for the game levels
         dudeDat.c       - dude graphics
         bulletDat.c     - bullet graphics
         fontDat.c       - font data (text letters and numbers, powerup art)
         menuDat.c       - the Opus Games logo

      asm directory
         mathAsm.s       - the single assembly file in the game... it has an integer division routine that
                           I grabbed as freeware from another website....

	  boot directory
		 crt0.s          - this is a GCC boot file... it contains assembly code that tells the GBA how to
						   start up, how to handle interrupts, and other low level boot code.  My version
						   is set up for C only (no C++) and single interrupt mode.

The files in this demo mini-game are provided as freeware.  If you want to
experiment with them or use pieces in your own GBA games, feel free!

Any questions? Visit <www.opusgames.com> or email me at <opus@opusgames.com>

-Opus

