Simple question about Vram

Post Reply
ex-peluo
Posts: 19
Joined: Wed Apr 15, 2009 10:44 pm

Simple question about Vram

Post by ex-peluo » Wed Apr 15, 2009 11:03 pm

Hi all. My question is simple. Can I reserve Vram freely or i need to reserve it in order. I'm playing with the sprites examples, and in the animated sprite sample if i change vramSetBankA(VRAM_A_MAIN_SPRITE); to vramSetBankB(VRAM_B_MAIN_SPRITE); it doesn' t work. I have nothing in Vram A and i think that is necesary to fill Vram A before use Vram B. Sorry, I 'am a noob and my english is too bad. I only trying to learn. Thanks.

eKid
Posts: 65
Joined: Sat Dec 06, 2008 6:07 pm
Contact:

Re: Simple question about Vram

Post by eKid » Thu Apr 16, 2009 12:12 am

Nope! You can assign the vram any way you want!! Here is the problem:

VRAM_A_MAIN_SPRITE has a default offset at the beginning of sprite vram, VRAM_B_MAIN_SPRITE has a default offset that is after the first block of sprite ram, change to "VRAM_B_MAIN_SPRITE_0x06400000" to set it to the beginning of sprite ram as with VRAM_A_MAIN_SPRITE.

ex-peluo
Posts: 19
Joined: Wed Apr 15, 2009 10:44 pm

Thanks!!!!

Post by ex-peluo » Thu Apr 16, 2009 12:18 am

Thanks, thats where one thing i didn't understood in reserve Vram banks. I'll keep playing with the examples. Thanks again : :mrgreen:

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Simple question about Vram

Post by Sylus101 » Thu Apr 16, 2009 3:58 am

Minor clarification... you really can't set VRAM any way you want, there are rules about which banks can be used for which tasks. In this case, the issue was that the VRAM_B_MAIN_SPRITE enumeration value is by default at an offset, 0x06420000. You can find a whole table of what each bank can be used for here http://www.dev-scene.com/NDS/NDS_Tutorials_VramTable
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

ex-peluo
Posts: 19
Joined: Wed Apr 15, 2009 10:44 pm

Re: Simple question about Vram

Post by ex-peluo » Thu Apr 16, 2009 2:23 pm

Yeah i know that it has some rules. I don't know if i have understood it well. In memory there are diferents places forsprites and BG, but you must reserve them using VramA,B,C,etc (having taken care of what screen you want to use, of course). So, the begining of sprites memory is in 0x6400000 = VRAM_A_MAIN_SPRITE = VRAM_B_MAIN_SPRITE_0x06400000 = VRAM_X_MAIN_SPRITE_0x06400000 (for the main screen). if you use VRAM_A for backgrouds, you must use another VRAM bank for sprites, but this VRAM bank must begin in the 0x06400000 offset. The same way is applied to bg, but then begins in 0x06000000 offset. Isn't them??

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Simple question about Vram

Post by Sylus101 » Thu Apr 16, 2009 3:28 pm

You'll get it, it just takes a little practice. Definitely read (and re-read as I've had to do) Day 2 of dovoto's tutorial. It should clear it up a bit.

http://dev-scene.com/NDS/Tutorials_Day_2

The important thing to focus on there, is that the VRAM banks actual memory address starts at 0x06800000. When a bank is assigned a job it takes on a virtual mapped address, like the 0x6400000 address used if it were for Main Screen Sprites.

I wouldn't think of the address as the offset. The only time you need an offset, is if you have 2 or more banks assigned to the same job. Like what you already have, if you use A and B both for Main screen sprites, you assign them that job, but you tell Bank B that it needs to be offset by 1. How much memory that offset is multiplied by differs depending on what banks you're using. In this case, it's x20000 or 128k (the size of the first assigned bank...). The libnds enumerations just try to make it easier by giving you simple entries for each Bank.

It's a bit in depth, but this is the main goto page to learn anything from the most in-depth technical standpoint as you're going to get.
http://nocash.emubase.de/gbatek.htm

To VRAM information:
http://nocash.emubase.de/gbatek.htm#dsmemorycontrolvram

To see how the affect of that offset value can really vary, look at using banks E,F and G for Main Bg or Main Sprite Vram.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

ex-peluo
Posts: 19
Joined: Wed Apr 15, 2009 10:44 pm

Re: Simple question about Vram

Post by ex-peluo » Thu Apr 16, 2009 8:40 pm

Thanks!!! Now i 'am practicing with tutorials and watching the urls you sent me. Thanks!!!!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests