Jump to content
  • Advertisement
Sign in to follow this  
hplus0603

GBA background scrolling?

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm playing around with the devkitARM / GBA emulators, and I can't get the BG2VOFS/BG2HOFS registers to work. In the documentation I've found (the PERN project and gbadev) there's no mention of anything special I'd need to do, so I'd assume that just setting BG2VOFS to 5 would scroll the background up by 5 pixels. However, it stubbornly stays at the origin. Any advice or pointers to documentation I missed would be appreciated.
int main()
{
  while( 1 ) {
    u16 x;
    SetMode( MODE_2 | BG2_ON );
    load_map( &map_testmap_c );
    for( x = 0; x < 128; ++x ) {
      while( (REG_VCOUNT&0xff) < 160 )
        /**/;
      BG2VOFS = ((x>>2)&31);
      while( (REG_VCOUNT&0xff) > 159 )
        /**/;
    }
    SetMode( 0x80 ); // clear screen
    for( x = 0; x < 10; ++x ) {
      while( (REG_VCOUNT&0xff) < 160 )
        /**/;
      while( (REG_VCOUNT&0xff) > 159 )
        /**/;
    }
  }
}

Share this post


Link to post
Share on other sites
Advertisement
Nevermind -- after mining the Google deeper, I found:

"The above BG scrolling registers are exclusively used in Text modes, ie. for all layers in BG Mode 0, and for the first two layers in BG mode 1.
In other BG modes (Rotation/Scaling and Bitmap modes) above registers are ignored. Instead, the screen may be scrolled by modifying the BG Rotation/Scaling Reference Point registers."

From this link.

Share this post


Link to post
Share on other sites

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!