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 > Where is the documentation for libnds?

#57496 - sirjorj - Sun Oct 16, 2005 3:44 pm

Greetings. I am working on a vertical scrolling shooter engine and I have made some progress thanks to doublec's tutorials. My ultimate goal is to extend the playing area up to the top screen. I am guessing I need to set the right video mode to make this possible. I cannot find any documents that list the video modes and what they are capable of.

In my searching, I found some info on the PA_Lib. This looks easier, but one of the reasons I am doing this is to learn more about the DS itself, so I would rather avoid another layer of abstraction.

I apologize in advance if there is some big obvious thing I am overlooking here. My basic question is how to extend doublec's framebuffer tutorial across both screens. My bigger question is where is some documentation that would answer my question and any future graphics mode related questions I will have.

jorj

sirjorj.com

#57501 - tepples - Sun Oct 16, 2005 4:14 pm

You'll need to use something other than framebuffer mode, such as one of the extended rotation modes. Or go back to the GBA, learn how to use tile mode, and come back.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#57512 - revo - Sun Oct 16, 2005 5:39 pm

sirjorj wrote:
My basic question is how to extend doublec's framebuffer tutorial across both screens.


In rPaint I made something like that on extended rotation bg mode:

Code:
#include <nds.h>

#define SCREEN1 BG_GFX
#define SCREEN2 BG_GFX_SUB

void on_irq()
{   
  if(REG_IF & IRQ_VBLANK) {
    VBLANK_INTR_WAIT_FLAGS |= IRQ_VBLANK;

    REG_IF |= IRQ_VBLANK;
  }
  else REG_IF = REG_IF;
}

void InitInterruptHandler()
{
  REG_IME = 0;
  IRQ_HANDLER = on_irq;
  REG_IE = IRQ_VBLANK;
  REG_IF = ~0;
  DISP_SR = DISP_VBLANK_IRQ;
  REG_IME = 1;
}

void InitSystem()
{
   powerON(POWER_ALL);

   videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE);
   vramSetBankB(VRAM_B_MAIN_BG_0x6000000);
   BG2_CR = BG_BMP16_256x256;

   BG2_XDX = 1<<8;
   BG2_XDY = 0;
   BG2_YDX = 0;
   BG2_YDY = 1<<8;
   BG2_CY = 0;
   BG2_CX = 0;

   videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
   vramSetBankC(VRAM_C_SUB_BG_0x6200000);
   SUB_BG3_CR = BG_BMP16_256x256;

   SUB_BG3_XDX = 1<<8;
   SUB_BG3_XDY = 0;
   SUB_BG3_YDX = 0;
   SUB_BG3_YDY = 1<<8;
   SUB_BG3_CY = 0;
   SUB_BG3_CX = 0;

   InitInterruptHandler();
   keysInit();
}

int main(void)
{
   InitSystem();

   while(1)
   {
      SCREEN1[10+(10<<8)]=RGB15(31,0,0)|BIT(15);
      SCREEN2[10+(10<<8)]=RGB15(0,0,31)|BIT(15);
      swiWaitForVBlank();
   }

   return 0;
}

_________________
[ sorry for all mistakes, but my english isn't as good as I wish it to be ]