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 > Dual screen console output

#160679 - Tor - Sun Jul 20, 2008 2:56 am

I have outputting to both screens working, but I am looking for a way to switch between the two without having the screen cleared. If the consoleCls('2') is removed from console.c, when the screen is switched, there is garbage displayed. Is there anyway around this?

#160685 - silent_code - Sun Jul 20, 2008 9:52 am

The main on top / bottom procedures should do the job... if that's what you are looking for? (You need to clarify how you are switching it, what the setup of the two 2D engines is and what the "garbage" looks like.)
_________________
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.

#160697 - Tor - Sun Jul 20, 2008 4:07 pm

I added
Code:
void consoleMoveMap(u16* map)
{
   row = col = 0;

   fontMap = map;
}
to libnds's console.c and compiled the lib.

in my code i have
Code:
inline void consoleOnBottom()
{
     //consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(2),(u16*)SCREEN_BASE_BLOCK_SUB(0),16);
   consoleMoveMap((u16*)SCREEN_BASE_BLOCK_SUB(2));
}
 
inline void consoleOnTop()

     //consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2),(u16*)SCREEN_BASE_BLOCK(0),16);
   consoleMoveMap((u16*)SCREEN_BASE_BLOCK(2));
}
consoleInitDefault will erase the screen due to the consoleCls('2'); call. without it, when the screen switches, there are lots of pluses, asterisks, and weird looking box kinda things. They are all characters and not in the bitmap background because if i attempt to draw over them, they are still showing.

Oh, and the vram layout (if it matters)
Code:
videoSetMode( MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE );
   
   vramSetBankA( VRAM_A_MAIN_BG_0x06000000 );
   
   BG3_CR = BG_BMP16_256x256;
   
   BG3_XDX=256;
   BG3_XDY=0;
   BG3_YDX=0;
   BG3_YDY=256;
   
   BG3_CY = (16*256);
        BG0_CR = BG_MAP_BASE( 2 );

   videoSetModeSub( MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE );
   
   vramSetBankC( VRAM_C_SUB_BG_0x06200000 );

   SUB_BG3_CR = BG_BMP16_256x256;
   
   SUB_BG3_XDX=256;
   SUB_BG3_XDY=0;
   SUB_BG3_YDX=0;
   SUB_BG3_YDY=256;
   SUB_BG3_CY = (16*256);
   SUB_BG0_CR = BG_MAP_BASE( 2 );

     BG_PALETTE[255] = RGB15(31,31,31);
     BG_PALETTE_SUB[255] = RGB15(31,31,31);

#160765 - hacker013 - Mon Jul 21, 2008 4:54 pm

Tor wrote:
I added
Code:
void consoleMoveMap(u16* map)
{
   row = col = 0;

   fontMap = map;
}
to libnds's console.c and compiled the lib.

in my code i have
Code:
inline void consoleOnBottom()
{
     //consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(2),(u16*)SCREEN_BASE_BLOCK_SUB(0),16);
   consoleMoveMap((u16*)SCREEN_BASE_BLOCK_SUB(2));
}
 
inline void consoleOnTop()

     //consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2),(u16*)SCREEN_BASE_BLOCK(0),16);
   consoleMoveMap((u16*)SCREEN_BASE_BLOCK(2));
}
consoleInitDefault will erase the screen due to the consoleCls('2'); call. without it, when the screen switches, there are lots of pluses, asterisks, and weird looking box kinda things. They are all characters and not in the bitmap background because if i attempt to draw over them, they are still showing.

Oh, and the vram layout (if it matters)
Code:
videoSetMode( MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE );
   
   vramSetBankA( VRAM_A_MAIN_BG_0x06000000 );
   
   BG3_CR = BG_BMP16_256x256;
   
   BG3_XDX=256;
   BG3_XDY=0;
   BG3_YDX=0;
   BG3_YDY=256;
   
   BG3_CY = (16*256);
        BG0_CR = BG_MAP_BASE( 2 );

   videoSetModeSub( MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE );
   
   vramSetBankC( VRAM_C_SUB_BG_0x06200000 );

   SUB_BG3_CR = BG_BMP16_256x256;
   
   SUB_BG3_XDX=256;
   SUB_BG3_XDY=0;
   SUB_BG3_YDX=0;
   SUB_BG3_YDY=256;
   SUB_BG3_CY = (16*256);
   SUB_BG0_CR = BG_MAP_BASE( 2 );

     BG_PALETTE[255] = RGB15(31,31,31);
     BG_PALETTE_SUB[255] = RGB15(31,31,31);


the memory from the console and the memory from the background are overlapping eachother.
_________________
Website / Blog

Let the nds be with you.

#160831 - Tor - Wed Jul 23, 2008 4:44 am

i was hoping someone would elaborate...but.. since the nds screen is only 256x192 (or something close to that) theres space reserved in the bitmap that isn't being used for the screen. So this shouldn't be an issue...right?

#160842 - silent_code - Wed Jul 23, 2008 11:55 am

As long as the VRAM banks are assigned propperly, you can access and use any memory "leftovers" via base and character blocks. :^)
_________________
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.

#160881 - Tor - Wed Jul 23, 2008 11:27 pm

so the code is correct... right?
so then why do i get random garbage when i change screens?