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.

Beginners > Libs

#74848 - Alpha_Slayer - Wed Mar 08, 2006 3:39 am

Okay, I've seen all over the web different libraries for GBA development. I have three main questions:

    1. How do I use these libs,

    2. What do I use them for,

and...
    3. Do I have to learn a new language for each of them, or are they compatible with C/C++? and/or Assembly Language?

_________________
Got a DS? Join the DSpot online forums!
www.DSpot.co.nr

#74883 - jake2431 - Wed Mar 08, 2006 2:09 pm

Alpha_Slayer wrote:
Okay, I've seen all over the web different libraries for GBA development. I have three main questions:

    1. How do I use these libs,

    2. What do I use them for,

and...
    3. Do I have to learn a new language for each of them, or are they compatible with C/C++? and/or Assembly Language?


1. You use libs by calling the functions, constants, etc. that the list has already coded for you so that you do not have to "reinvent the wheel" everything you code.

2. You use them for things like setting graphics modes, displaying graphics, writing text, and pretty much everything that you will be doing(like using an api).

3. No you do not need to learn a new language. Most of the libs out there work will c/c++ so you will be fine with most.

#74936 - Alpha_Slayer - Wed Mar 08, 2006 11:33 pm

Quote:
You use libs by calling the functions, constants, etc. that the list has already coded for you so that you do not have to "reinvent the wheel" everything you code.

Could you give me an example of what a call looks like?
_________________
Got a DS? Join the DSpot online forums!
www.DSpot.co.nr

#74944 - keldon - Thu Mar 09, 2006 12:57 am

Like any other function call.

Code:
if(key_hit(KEY_START))
            REG_DISPCNT ^= DCNT_OBJ_1D;

        // Hey look, it's one of them build macros!
        metr->attr2= OE_A2_BUILD(tid, pb, 0);


From the tonc tutorials, hey_hit and OE_A2_BUILD are library functions. Well OE_A2_BUILD is actually a macro - but nethetheless you might want to learn how to program first before anything else.[/code]

#74947 - sajiimori - Thu Mar 09, 2006 1:01 am

Code:

// C
  f()

// ARM
  bl f

// x86
  call f

// Lisp
  (f)

// Forth
  f

#74965 - tepples - Thu Mar 09, 2006 3:06 am

Code:

// 6502 assembly
  jsr f

//BASIC
  gosub 14000

//QBasic
  f

// Scheme: See LISP
// C++: See C
// Java: See C
// C#: See C

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#75089 - Alpha_Slayer - Fri Mar 10, 2006 1:55 am

Thanks everybody, those examples were really useful! :)
_________________
Got a DS? Join the DSpot online forums!
www.DSpot.co.nr