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.

Beginners > Background Difficulties

#153925 - biubid_boy - Tue Apr 08, 2008 2:32 pm

Hello Guys,
I'm just trying to get a regular 512x512 background to show up.

This is the image I am using:
[Images not permitted - Click here to view it]

This is the code I'm using:
Code:
#include <gba.h>
#include "..\data\citymap.h"
#include <string.h>

int main(void)
{   
    irqInit();
    irqEnable(IRQ_VBLANK);
    SetMode(MODE_0 | BG0_ON | OBJ_ON | OBJ_1D_MAP);
   
    memcpy(BG_PALETTE, citymapPal  , 512);
    memcpy(CHAR_BASE_BLOCK(0), citymapTiles, citymapTilesLen);
    memcpy(SCREEN_BASE_BLOCK(28),citymapMap  , citymapMapLen);
    BGCTRL[0] = CHAR_BASE(0) | SCREEN_BASE(28) | BG_256_COLOR | BG_SIZE_3;
   
    while(1)
    { 
        VBlankIntrWait();
    }
}


And this is the result I am getting:
[Images not permitted - Click here to view it]

What am I doing wrong?

Thanks,
Biubid_boy.

#153927 - eKid - Tue Apr 08, 2008 2:44 pm

How are you converting the image? 512x512 isn't really a big linear 64x64 block, it's 4 smaller 32x32 blocks put together. The first block is the top left block, followed by the top right block, then bottom left, and then bottom right.

#153929 - biubid_boy - Tue Apr 08, 2008 3:14 pm

I'm using the 'sbb' option of Usenti, which I believe corrects this problem, but to no avail.