#96875 - omaremad - Sun Aug 06, 2006 3:26 am
Ok here is what im trying to do:
1-have a console on the subscreen.
2-have a second bg exrot or not that is fullscreen
i tried using tiled bg's for the second back ground but it looked very corrupted, probably because i had too many tiles(the console works fine on its own, the bg is fine on its own and the char blocks/ map block dont overlap etc.....)
so i attempted the exrot method using vram offsets since a 256*256 exrot takes the whole 128kb per vram bank.
this would have worked with vram offsetting but!
it appears that vram bank c is the only one that can be mapped to the sub BG's while A,B,D can be mapped easily to the main BG.
lcd swap i hear you say....
I am also running 3d on the main core so i have to use the subscreen.
maybe my font is too large? (custom font example)i spent way too long tweaking this...
#96876 - tepples - Sun Aug 06, 2006 3:30 am
Can you provide a memory map of what things go where in bank C (like VBA's Tile Viewer)? Do any DS emulators support this? How many colors is your full-screen background, and how many colors are your font tiles? 16, 256, or thousands?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#96883 - knight0fdragon - Sun Aug 06, 2006 4:46 am
you forgot about maps EFGH&I, , both H and I can be mapped to sub screen
do something like this
place VRAM_C_SUB_BG_0x6220000 where you normally declare your VRAMC
vramSetBankH(VRAM_H_SUB_BG);
have your console screen point to 0 and char point to 1
then in your BG#_CR add | BG_BMP_RAM_SUB(5)
_________________
http://www.myspace.com/knight0fdragonds
MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206
#96922 - omaremad - Sun Aug 06, 2006 4:42 pm
Thanks for that but i cant get the sub screen exrot to work(console does now thanks)
Code: |
vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_TEXTURE,VRAM_C_SUB_BG_0x6220000, VRAM_D_TEXTURE);
//Kinda complex vram setup but i dont like tiled graphics much
//Hardware start
videoSetMode(MODE_5_3D | DISPLAY_BG2_ACTIVE);
videoSetModeSub(MODE_5_2D|DISPLAY_BG0_ACTIVE|DISPLAY_BG2_ACTIVE);
//BGS"S tidided
BG2_CR = BG_BMP16_256x256 | BLEND_ALPHA | BG_PRIORITY(3)|BG_WRAP_ON;
BG0_CR =BG_PRIORITY(3)|BLEND_ALPHA;
// Set translations
BG2_XDX = 1<<8;
BG2_XDY = 0;
BG2_YDX = 0;
BG2_YDY = 1<<8;
BG2_CY = 0;
BG2_CX = 0;
JPEG_DecompressImage((uint8*)gbfs_get_obj(&data_gbfs, "om.jpg", NULL), BG_GFX, 256, 256);
BLEND_CR = (2<<6) | BLEND_DST_BG2 | BLEND_SRC_BG0;
BLEND_AB = 15 | (15<<8);
vramSetBankH(VRAM_H_SUB_BG);
SUB_BG0_CR = BG_MAP_BASE(31);
//
SUB_BG2_CR = BG_BMP16_256x256| BG_BMP_RAM_SUB(1);
JPEG_DecompressImage((uint8*)gbfs_get_obj(&data_gbfs, "om.jpg", NULL), (uint16*)BG_BMP_RAM_SUB(1), 256, 256);
BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255
//consoleInit() is a lot more flexible but this gets you up and running quick
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); |
top screen displays 3d on bg0 and an exrot on bg2
bottom has console running on bankH bg0
exrot running on bankC next offset which is 0x62200
is any of this code wrong
note this cast (uint16*)BG_BMP_RAM_SUB(1)
i used it to get it to compile, would this affect the output(i see a grey exrot which is good bc my image contains grey)
#96954 - knight0fdragon - Mon Aug 07, 2006 12:05 am
no...... you would want bmp ram to go to 6, not 1, and that address would be 0x0622-4000, the address of H would be 0x0620-0000, thus you want to point bmpram at 5, which is the start of the pointer to vram C
_________________
http://www.myspace.com/knight0fdragonds
MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206
#96957 - omaremad - Mon Aug 07, 2006 12:11 am
ooouch my roter crashed an i couldnt post that code was wrong, thatnks for your guidance it helped my understand allot.
well the vram c is at 0x62000
the bgmpram ofsset is in 0x400's so 5 *400 =2000
+60000
62000
:)
the screen was also grey because i didnt set the second affine matrix (i only done it for the main screen
#96959 - omaremad - Mon Aug 07, 2006 12:14 am
Ok just to make sure
the console is mapped to H
screen block =0
char block=1
exrot
bmp(5)
is this correct?
#99023 - jonezer4 - Sat Aug 19, 2006 2:53 am
I've been struggling for some time with a simliar problem to this. If anyone could help it'd be extremely appreciated.
First of all, I'm using an 8-bit, 256 x 256 image for my background. Shouldn't this only take up half of vRAM C, leaving plenty of room to store console data? For some reason I can't get both to fit in C.
That said, I've tried what's been explained here and I cannot get the console to print correctly. The image in BG3 displays fine, but the console text (BG0) is all messed up. What am I doing wrong?
Code: |
vramSetMainBanks(VRAM_A_MAIN_BG_0x6000000, VRAM_B_MAIN_SPRITE,
VRAM_C_SUB_BG_0x6200000, VRAM_D_SUB_SPRITE);
vramSetBankH(VRAM_H_SUB_BG); //32 kb
//Use main Screen (bottom) to display player cards
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D
);
BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(3);
// Use the sub screen (top) as background with image and sprites
videoSetModeSub(MODE_5_2D | DISPLAY_BG0_ACTIVE //text
|DISPLAY_BG3_ACTIVE //image
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D //this is used when in tile mode
);
////////////////set up text background////////////////////
BG_PALETTE_SUB[0] = RGB15(2,2,25); //background color
SUB_BG0_CR = BG_MAP_BASE(0) | BG_PRIORITY(1);//use bg1 for the text
BG_PALETTE_SUB[255] = RGB15(31,0,0); //font color
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(0), (u16*)CHAR_BASE_BLOCK_SUB(1), 16);
///////////////set up bitmap background
SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_RAM_SUB(5) | BG_PRIORITY(3);
dmaCopy(bgTop_bin, BG_GFX_SUB, bgTop_bin_size);
dmaCopy(bgTopPal_bin, BG_PALETTE_SUB, bgTopPal_bin_size);
dmaCopy(bgBottom_bin, BG_GFX, bgBottom_bin_size);
dmaCopy(bgBottomPal_bin, BG_PALETTE, bgBottomPal_bin_size);
|
#99025 - knight0fdragon - Sat Aug 19, 2006 3:00 am
jonezer4 wrote: |
I've been struggling for some time with a simliar problem to this. If anyone could help it'd be extremely appreciated.
First of all, I'm using an 8-bit, 256 x 256 image for my background. Shouldn't this only take up half of vRAM C, leaving plenty of room to store console data? For some reason I can't get both to fit in C.
|
if it is 8 bit color, then it is 64k, if it is 16bit color, it is 128k
jonezer4 wrote: |
That said, I've tried what's been explained here and I cannot get the console to print correctly. The image in BG3 displays fine, but the console text (BG0) is all messed up. What am I doing wrong?
Code: |
vramSetMainBanks(VRAM_A_MAIN_BG_0x6000000, VRAM_B_MAIN_SPRITE,
VRAM_C_SUB_BG_0x6200000, VRAM_D_SUB_SPRITE);
vramSetBankH(VRAM_H_SUB_BG); //32 kb
//Use main Screen (bottom) to display player cards
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D
);
BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(3);
// Use the sub screen (top) as background with image and sprites
videoSetModeSub(MODE_5_2D | DISPLAY_BG0_ACTIVE //text
|DISPLAY_BG3_ACTIVE //image
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D //this is used when in tile mode
);
////////////////set up text background////////////////////
BG_PALETTE_SUB[0] = RGB15(2,2,25); //background color
SUB_BG0_CR = BG_MAP_BASE(0) | BG_PRIORITY(1);//use bg1 for the text
BG_PALETTE_SUB[255] = RGB15(31,0,0); //font color
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(0), (u16*)CHAR_BASE_BLOCK_SUB(1), 16);
///////////////set up bitmap background
SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_RAM_SUB(5) | BG_PRIORITY(3);
dmaCopy(bgTop_bin, BG_GFX_SUB, bgTop_bin_size);
dmaCopy(bgTopPal_bin, BG_PALETTE_SUB, bgTopPal_bin_size);
dmaCopy(bgBottom_bin, BG_GFX, bgBottom_bin_size);
dmaCopy(bgBottomPal_bin, BG_PALETTE, bgBottomPal_bin_size);
|
|
I believe one of the things needed in the sub CR is BG_COLOR_256 or something like that
also you are copying the background to the wrong place in memory, you want to do dmaCopy(bgTop_bin, &BG_GFX_SUB[0x20000], bgTop_bin_size);
also you want to point VRAMC to VRAM_C_SUB_BG_0x6220000 not VRAM_C_SUB_BG_0x6200000
_________________
http://www.myspace.com/knight0fdragonds
MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206
#99029 - jonezer4 - Sat Aug 19, 2006 3:59 am
Knight, thanks a ton for your speedy reply.
I've implemented your recommended changes but now I'm getting no console font and my image is coming through very wrong. I probably messed something up along the way. Here's the current code...
Code: |
vramSetMainBanks(VRAM_A_MAIN_BG_0x6000000, VRAM_B_MAIN_SPRITE,
VRAM_C_SUB_BG_0x6220000, VRAM_D_SUB_SPRITE);
vramSetBankH(VRAM_H_SUB_BG);
//Use main Screen (bottom) for image
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D //this is used when in tile mode
);
BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(3);
// Use the sub screen (top) for output
videoSetModeSub(MODE_5_2D | DISPLAY_BG0_ACTIVE //text
|DISPLAY_BG3_ACTIVE //image
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_1D //this is used when in tile mode
);
////////////////set up text background////////////////////
SUB_BG0_CR = BG_MAP_BASE(0) | BG_PRIORITY(0) | BG_COLOR_256 ;//use bg0 for the text
BG_PALETTE_SUB[255] = RGB15(31,0,0); //font color
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(0), (u16*)CHAR_BASE_BLOCK_SUB(1), 16);
///////////////set up our bitmap background///////////////////////
SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_RAM_SUB(5) | BG_PRIORITY(3);
dmaCopy(bgTop_bin, &BG_GFX_SUB[0x20000], bgTop_bin_size);
dmaCopy(bgTopPal_bin, BG_PALETTE_SUB, bgTopPal_bin_size);
dmaCopy(bgBottom_bin, BG_GFX, bgBottom_bin_size);
dmaCopy(bgBottomPal_bin, BG_PALETTE, bgBottomPal_bin_size); |
If you don't mind me asking, why do you map the VRAM to 0x6220000 and not the standard 0x6200000?
Also, since I'm not using anywhere near all of VRAM C's bank, would it stand to reason that I can omit the H bank?
#99386 - knight0fdragon - Mon Aug 21, 2006 6:09 am
I made a quick sample of how to do tile and bmp at the same time
you can find it here http://hyperclubbingfriends.yourfreewebspace.com/Knight0fDragon/
_________________
http://www.myspace.com/knight0fdragonds
MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206