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.

DS development > powering on 2d

#160581 - vuurrobin - Fri Jul 18, 2008 1:05 am

hello

at most tutorials I've seen that you need to turn on the 2d engines using "powerON(POWER_ALL_2D)". but at the tutorial of devscene, I don't see anything that turns it on. how is that possible?

I also saw at liranuna's tutorial that he/she/they uses "REG_POWERCNT = POWER_ALL_2D" to turn it on. I'm guessing that this is just an older way of doing it, but is there any difference in it or is it the same as "powerON(POWER_ALL_2D)".

and lastly, I looked for "powerON()" in the libnds documentation, but I couldn't find it (as wel as BIT()). does anybody knows how up to date that is?

#160607 - M3d10n - Fri Jul 18, 2008 10:16 am

If you look at the libnds headers and source, you'll see that powerON() just does that: it sets the flags you pass to REG_POWERCNT.

#160610 - AntonioND - Fri Jul 18, 2008 11:26 am

In last libnds (I think).

BIT():
Code:
C:\devkitPro\libnds\include\nds\jtypes.h

Quote:
#define BIT(n) (1 << (n))



powerON():
Code:
C:\devkitPro\libnds\include\nds\system.h

Quote:
static inline
void powerON(int on) { REG_POWERCNT |= on;}

#160634 - vuurrobin - Fri Jul 18, 2008 10:07 pm

thanks, that does explain some things, but it doesn't explain why devscene's example programs works without powering on or why those commands aren't in the libnds documentation on http://libnds.devkitpro.org/index.html (the entire jtypes.h file isn't in it, and it is only 5 months old).

I just checked with some examples from devkitarm/libnds, and I saw that some examples also doesn't power on the 2d hardware (but they do work). I just want to know when to turn it on and when not, and why de libnds documentation is incomplete.

and how do you get an grit rule file? some tutorials say that you should include it and include it for there pictures, but they don't say how to make one for your own pictures.


sorry for all the (newb) questions (compared to the other topics), but these things just really puzzles me.

#160639 - eKid - Sat Jul 19, 2008 1:23 am

Sometimes programs may get away without powering on the 2D hardware because it is usually already powered up. But you should power it on yourself anyway without assuming anything is initialized to what you want.

#160640 - Polaris - Sat Jul 19, 2008 1:25 am

http://www.coranac.com/man/grit/html/index.htm

All the info on how to handle grit is there, it's not that long either. Just make sure to start reading from the begining :P

Now for the quick answer. A grit rule file is just a text file in which you change the extension to .grit. It should contain all the options you want grit to use on a given file.

If i recall right there are two ways of using them. One is having a rule file specifically for a file, in which case it should be named after the file it is being used on. The other is having a rule file for all the images in a directory.

But ignore my rambling, just go read the link above, it explains everything in great detail.

#160672 - vuurrobin - Sat Jul 19, 2008 11:44 pm

thank you very much, that ansers all my questions (I have so far) :)

#160694 - Holland - Sun Jul 20, 2008 3:57 pm

someone was so kind to link this to me when I was looking. I guess it's time to pay it forward

http://nocash.emubase.de/gbatek.htm

if you know even a little bit about bitwise operations this doc will be invaluable to you. it takes a little bit of time and effort but you'll just have to look through tutorial code, see what register they are changing..then dig up that register in gbatek.

I love the ndslib a lot, but understanding the hardware will result in much better code than just relying on the library itself. :)

#160698 - silent_code - Sun Jul 20, 2008 4:43 pm

@ Holland: Correction! It's libnds. ;^)
(ndslib is another, older and discontinued library.)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#160721 - Holland - Mon Jul 21, 2008 3:01 am

silent_code wrote:
@ Holland: Correction! It's libnds. ;^)
(ndslib is another, older and discontinued library.)

haha...i stand corrected! i love dovoto's VS wizard. Haven't had to type in the #includes since I got it. :c)