#25627 - Code Monkey - Thu Aug 26, 2004 7:38 am
As a newbie gba coder, I've been reading devoto's PERN Project tutorials along with the TONC guide. I've managed to write a small gba app that blits a 64x64 tiled sprite onto the screen in mode0, mostly modelled from PERN tutorial code.
the sprite data is generated from a 64x64 256-color pcx image using pcx2sprite.
[Images not permitted - Click here to view it]
This works. However, when replacing this with the USENTI's generated code (tile mode 64x64 8bpp) , the sprite is garbled.
[Images not permitted - Click here to view it]
(Usenti is a very cool paint-style app written by the guy who did the TONC tutorials. I like it, so i'd rather use that than pcx2sprite)
I'm assuming the data is generated in a slightly different way, and there is some small nuance of this that i'm misunderstanding. Can anyone explain it?
Code is below, sprite data included in links above.
The TONC tutorials that use usenti-generated images use dma, and I'd rather get a grasp for things with simple for loop-style copying operations before i start relying on dma transfers.
Thanks.
the sprite data is generated from a 64x64 256-color pcx image using pcx2sprite.
[Images not permitted - Click here to view it]
This works. However, when replacing this with the USENTI's generated code (tile mode 64x64 8bpp) , the sprite is garbled.
[Images not permitted - Click here to view it]
(Usenti is a very cool paint-style app written by the guy who did the TONC tutorials. I like it, so i'd rather use that than pcx2sprite)
I'm assuming the data is generated in a slightly different way, and there is some small nuance of this that i'm misunderstanding. Can anyone explain it?
Code is below, sprite data included in links above.
Code: |
OAM_Entry oam_buffer[128]; int i; //set video mode.. zero out oam SetMode(MODE_0 | OBJ_ENABLE | OBJ_MAP_1D); //sets that bit in all the oam entries so that the sprites will be hidden initOAM(oam_buffer); //init oam buffer; oam_buffer[0].attribute[0] = COLOR_256 | SQUARE; oam_buffer[0].attribute[1] = SIZE_64; oam_buffer[0].attribute[2] = 0; //copy data from pcx2sprite into video memory for(i = 0; i < 64 * 64 / 2; i++) OAMData[0 * 16 + i] = plane1Data[i]; for(i = 0; i < 256; i++) OBJPaletteMem[i] = plane1Palette[i]; //update oam entry from buffer updateOAM(oam_buffer); while(1); |
The TONC tutorials that use usenti-generated images use dma, and I'd rather get a grasp for things with simple for loop-style copying operations before i start relying on dma transfers.
Thanks.