gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > getting in to GB dev

#175511 - ishkabible - Fri Dec 10, 2010 2:58 am

so i want to start programing for GB by using an emulator (that i have to play games with). i would like to programing in c but I'm unaware of any compilers for the GB architecture. is there i compiler i can download just the binarys so i don't have to compile it? just looking for the easiest way to get started, thanks!!

#175512 - kusma - Fri Dec 10, 2010 10:30 am

http://gbdk.sourceforge.net/

#175515 - gauauu - Fri Dec 10, 2010 4:11 pm

I assume because you said GB and that you weren't aware of compilers, that you mean the old-school gameboy. If so, carry on with what Kusma said.

If not, and you actually mean GBA, read the beginner's forum here, then google for devkitpro.

#175519 - ishkabible - Sat Dec 11, 2010 2:21 am

ok i found devKitPro and im getting it setup for my use but im not getting some things in the console demo to work.

here is the code:
Code:

#include <gba_console.h>
#include <gba_video.h>
#include <gba_interrupt.h>
#include <gba_systemcalls.h>

#include <stdio.h>
//---------------------------------------------------------------------------------
// Program entry point
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------

   // the vblank interrupt must be enabled for VBlankIntrWait() to work
   // since the default dispatcher handles the bios flags no vblank handler
   // is required
   irqInit();
   irqEnable(IRQ_VBLANK);

   consoleDemoInit();

   // ansi escape sequence to clear screen and home cursor
   // /x1b[line;columnH
   iprintf("\x1b[2J");

   // ansi escape sequence to set print co-ordinates
   // /x1b[line;columnH
   iprintf("\x1b[10;10HHello World!");

   // ansi escape sequence to move cursor up
   // /x1b[linesA
   iprintf("\x1b[10ALine 0");

   // ansi escape sequence to move cursor left
   // /x1b[columnsD
   iprintf("\x1b[28DColumn 0");

   // ansi escape sequence to move cursor down
   // /x1b[linesB
   iprintf("\x1b[19BLine 19");

   // ansi escape sequence to move cursor right
   // /x1b[columnsC
   iprintf("\x1b[5CColumn 20");

   while (1) {
      VBlankIntrWait();
   }
}


it says that irqInit,irqEnable,consoleDemoInit are all undefined. where are they supposed to be defined? i linked libgba, libmm, and libfat, didn't change anything so im guessing there defined somewhere else, but where?

#175520 - Dwedit - Sat Dec 11, 2010 3:43 am

Build the example programs using the included makefile. Once you got that working, copy it to another folder and start coding.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#175521 - ishkabible - Sat Dec 11, 2010 5:25 am

i tired that and it was all messy so i just made my own make file, i can post it if you want.

Code:

call arm-eabi-gcc -Wall -mthumb -mthumb-interwork -specs=gba_mb.specs console.c -o console.elf
call arm-eabi-objcopy -O binary hello.elf hello.mb
pause>nul


simple not like those complicated make files that the builds come with, i just run this from inside the binary folder, ill get a project folder setup after i can get this stuff working.

#175522 - elwing - Sat Dec 11, 2010 9:55 am

if you're interested in GBA dev, you should really read tonc...
http://www.coranac.com/projects/#tonc

#175529 - Miked0801 - Wed Dec 15, 2010 12:51 am

Wow, after all these years, I never really looked at that link. That is an absolutely amazing resource. My only wish would be for the math section to go just a couple steps further into 3D transforms and then it would be even more applicable to modern day 3D programming systems. I wish my Linear Algebra teacher was as good as this article! :)

#175530 - headspin - Wed Dec 15, 2010 7:50 am

I'm suprised you've never seen Cearn's Tonc Mike.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#175549 - Miked0801 - Mon Dec 20, 2010 6:42 pm

I've heard it referenced a bunch, but never bothered to go look. While I didn't pick up anything new personally, I found it to be well organized and easy to read. Like I said, good stuff :)

#175974 - squidtantrum - Sun Mar 13, 2011 10:24 pm

Can GBDK be used to write games for gameboy color?