Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 255939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:58:21+00:00 2026-05-11T21:58:21+00:00

I’m working on a pong game for the Nintendo DS. I’m using libnds to

  • 0

I’m working on a pong game for the Nintendo DS. I’m using libnds to set things up and I’ve come across a very strange behaviour. So far I’ve only tried it out in emulators, but I use three different ones and they all exhibit this behaviour so I suspect I’m doing something bad.

The actual problem is that when I use background layer 1 or above for my tiled graphics, I get weird stripes all over that layer. If I use background layer 0 the problem goes away, but since that is rendered last, I cannot actually draw over it in another layer, which I want to.

My setup code:

void pong::setup_engine()
{
    // Setup DS graphics engine.
    // -------------------------
    videoSetMode(MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG1_ACTIVE | DISPLAY_BG2_ACTIVE);
    vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
    vramSetBankB(VRAM_B_MAIN_BG_0x06020000);

    u8 *tileMemory = reinterpret_cast<u8 *>(BG_TILE_RAM(1));
    u16 *mapMemory = reinterpret_cast<u16 *>(BG_MAP_RAM(0));

    int bg0 = bgInit(1, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
    int bg1 = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
    //bgScroll(bg0, 256, 256);

    u16 *ptr = bgGetGfxPtr(bg1);
    for (int y = 10; y < 128*60; y++)
    {
        ptr[y] = 0xFFFF;
    }

    BG_PALETTE[1] = grey0;
    BG_PALETTE[2] = grey1;
    BG_PALETTE[3] = grey2;
    BG_PALETTE[4] = grey3;
    BG_PALETTE[5] = grey4;
    BG_PALETTE[6] = grey5;
    BG_PALETTE[7] = grey6;

    // 32 here is not 32 bytes but 32 half-words, which is 64 bytes.
    swiCopy(CORNER_TILE, tileMemory, 32);
    swiCopy(TOP_TILE, tileMemory + 64, 32);
    swiCopy(SIDE_TILE, tileMemory + (64 * 2), 32);
    swiCopy(MAIN_TILE, tileMemory + (64 * 3), 32);

    swiCopy(MAP, mapMemory, 32*24);
}

In the above code I use layer 1 for bg0, which is my tiled graphics layer. This makes the weird stripes appear; if I were to change it to 0 like this, it would show up as expected:

int bg0 = bgInit(0, BgType_Text8bpp, BgSize_T_256x256, 0, 1);

Any ideas what causes the problem, and what the solution is?

Image of weird stripes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:58:21+00:00Added an answer on May 11, 2026 at 9:58 pm

    a breif look at background.h makes it look like you are using BG1 and BG2. For mode 5, according to:

    http://nocash.emubase.de/gbatek.htm

    layer 0 and 1 are normal and 2 and 3 are extended. I dont know what extended means. If you want to just do normal tile stuff you probably want to bgInit 0 and 1 not 1 and 2.

    You can change the priorities around at will, layer 0 is not necessarily on top of 1, etc. Look at the BGxCNT registers (BG0CNT, BG1CNT,…) and the priority bits. Now if the priority is a tie then yes the layer number determines who wins.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.