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 )
/**/;
}
}
}
GBA background scrolling?
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.
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.
"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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement