#148663 - nipil - Tue Jan 08, 2008 2:26 pm
"Disclaimer" :
i do apologize for the length of this post. I write lots of stuff, as it helps
me be sure i'm not confusing while writing it, and provides all the info i
managed to gather, which (i hope) helps to find the answers to the
questions i ask ;)
Right now, i've been doing my stuff on main screen, using console output on sub to debug (both mode5). I was setting VRAM A&B to main background.
I'm currently using :
- BG_MAP_BASE(0) (16k of maps available)
- BG_TILE_BASE(1) (16k of sprites available)
- an extended 256x256@16 BG3 (128k of memory available)
I just realize i was "wasting" memory by assigning B, which i might use for something else later.
So i decided to change the setting from A+B to A(128k)+F(16k)+G(16k) :
Then i realized banks F & G didn't specify adresses to map to. So i took a look at gbatek's VRAM memory control. There i found:
What i understand from this is that contrary to A, for F&G, OFS is not a counter :
- A can be mapped to 600:0000, and "ends" at 601:FFFFh.
- F can be mapped to 4 different adresses using the 2 lower bits of the 4-bits OFS
- G is the same as F
Possible base F addresses are then :
- 600:0000h (OFS=0) ending at 600:3FFFh
- 600:4000h (OFS=1) ending at 600:7FFFh
- 601:0000h (OFS=2) ending at 601:3FFFh
- 601:4000h (OFS=3) ending at 601:7FFFh
I thought i would have mapped it as shown below (each letter being a 16k block) :
As you can see, A overlaps F or G no matter OFS. So i guess i cannot achieve target placement.
In turn, i *could* invert the positions of the banks, as shown below :
Now we reached this point, i have, as you can guess, some questions :
- Can we really order the mapping as we want ?
- Is there a problem with the 6 unused (u) 16k adresse blocks ?
- There's a define for A on 602:0000h, but i don't seeany define to place F or G (ie using OFS lower bits), how do i do it ?
- I'm currently using the first code-block (F & G without adresses). I fell there's a problem with it, but it works (in no$gba). Is it normal ?
The next thing i plan to do is to display exactly the same thing on both screens.
As such, i have to configure banks for the sub engine. The same page from gbatek gives me and the associate placement :
As stated, max usable memory is 128k (ie, no using C plus another bank). Anyway, H and G overlap with C.
Final question is :
- What are my options for sub-engine configuration ?
i do apologize for the length of this post. I write lots of stuff, as it helps
me be sure i'm not confusing while writing it, and provides all the info i
managed to gather, which (i hope) helps to find the answers to the
questions i ask ;)
Right now, i've been doing my stuff on main screen, using console output on sub to debug (both mode5). I was setting VRAM A&B to main background.
I'm currently using :
- BG_MAP_BASE(0) (16k of maps available)
- BG_TILE_BASE(1) (16k of sprites available)
- an extended 256x256@16 BG3 (128k of memory available)
I just realize i was "wasting" memory by assigning B, which i might use for something else later.
So i decided to change the setting from A+B to A(128k)+F(16k)+G(16k) :
Code: |
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankF(VRAM_F_MAIN_BG); vramSetBankG(VRAM_G_MAIN_BG); |
Then i realized banks F & G didn't specify adresses to map to. So i took a look at gbatek's VRAM memory control. There i found:
Code: |
VRAM SIZE MST OFS ARM9, 2D Graphics Engine A, BG-VRAM (max 512K)
A,B,C,D 128K 1 0..3 6000000h+(20000h*OFS) E 64K 1 - 6000000h F,G 16K 1 0..3 6000000h+(4000h*OFS.0)+(10000h*OFS.1) |
What i understand from this is that contrary to A, for F&G, OFS is not a counter :
- A can be mapped to 600:0000, and "ends" at 601:FFFFh.
- F can be mapped to 4 different adresses using the 2 lower bits of the 4-bits OFS
- G is the same as F
Possible base F addresses are then :
- 600:0000h (OFS=0) ending at 600:3FFFh
- 600:4000h (OFS=1) ending at 600:7FFFh
- 601:0000h (OFS=2) ending at 601:3FFFh
- 601:4000h (OFS=3) ending at 601:7FFFh
I thought i would have mapped it as shown below (each letter being a 16k block) :
Code: |
|<- VRAM base 600:0000h
Target placement |AAAAAAAA........ |........F....... |.........G...... Possible F & G placements using OFS |AAAAAAAA........ |FF..FF.......... |GG..GG.......... |
As you can see, A overlaps F or G no matter OFS. So i guess i cannot achieve target placement.
In turn, i *could* invert the positions of the banks, as shown below :
Code: |
Potential solution by moving A to 602:0000h
|........AAAAAAAA |FF..FF.......... |GG..GG.......... Let's say i retain this one : |..uuuuuu........ unused adresses |........AAAAAAAA |F............... (OFS=0) |.G.............. (OFS=1) |
Now we reached this point, i have, as you can guess, some questions :
- Can we really order the mapping as we want ?
- Is there a problem with the 6 unused (u) 16k adresse blocks ?
- There's a define for A on 602:0000h, but i don't seeany define to place F or G (ie using OFS lower bits), how do i do it ?
- I'm currently using the first code-block (F & G without adresses). I fell there's a problem with it, but it works (in no$gba). Is it normal ?
The next thing i plan to do is to display exactly the same thing on both screens.
As such, i have to configure banks for the sub engine. The same page from gbatek gives me and the associate placement :
Code: |
GbaTek:
VRAM SIZE MST OFS ARM9, 2D Graphics Engine B, BG-VRAM (max 128K) C 128K 4 - 6200000h H 32K 1 - 6200000h I 16K 1 - 6208000h Associated placement : |........CCCCCCCC |........H....... |..........G..... |
As stated, max usable memory is 128k (ie, no using C plus another bank). Anyway, H and G overlap with C.
Final question is :
- What are my options for sub-engine configuration ?