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.

Coding > White screen after compilation

#147951 - mog123 - Mon Dec 31, 2007 12:41 am

Hi, I'm doing the crash course from http://www.webbesen.dk/gba/

though I'm not using devkitadvance but devkitarm. I did update all the make files. I get no errors while compiling, but when I launch the GBA file to VBA in just shows me a white screen. Can somebody help?

Edit: the elf file runs perfectly, though the GBA file gives me a white screen, hmm.

#147952 - dantheman - Mon Dec 31, 2007 1:11 am

Does it work if you rename it to end in .mb rather than .gba?

#148257 - mog123 - Fri Jan 04, 2008 12:19 am

I have another problem and didn't want to make another topic, I'm doing the sprite routine, here's my code:

Code:
#include "gba.h"
#include "bg.h"
#include "ball.h"

void InitializeSprites(void);
void CopyOAM(void);

OAMEntry sprites[128];

int main()
{
   u16 loop;

   SetMode(MODE_4 | BG2_ENABLE | OBJ_ENABLE | OBJ_MAP_1D);

   for (loop = 0; loop <256; loop++)
   {
   OBJ_PaletteMem[loop] = ballPalette[loop];
   }

   for (loop = 0; loop <256; loop++)
   {
   BG_PaletteMem[loop]=bgPalette[loop];
   }

   for (loop = 0; loop < (120*160); loop++)
   {
   FrontBuffer[loop] = bgData[loop];
   }

   memcpy( (u16 *)0x06014000, &ballData, sizeof(ballData) );

   sprites[0].attribute0 = COLOR_256 | SQUARE | 50;
   sprites[0].attribute1 = SIZE_8 | 30;
   sprites[0].attribute2 = 512;

   while(1)
      {
      WaitForVsync();
      CopyOAM();
      }
   return 0;
}

void InitializeSprites(void)
{
   u16 loop;
   for(loop = 0; loop < 128; loop++) {
      sprites[loop].attribute0 = 160;
      sprites[loop].attribute1 = 240;
   }
}

void CopyOAM(void)
{
   u16 loop;
   u16* temp;
   temp = (u16*)sprites;
   for(loop = 0; loop < 128*4; loop++)   {
      OAM_Mem[loop] = temp[loop];
   }
}


It's exactly the same as on the website(though I've written it myself) I've added extra lines on the end, but I don't get a sprite on the screen, only the BG, can someone help?

#148260 - wintermute - Fri Jan 04, 2008 12:27 am

Pretend you never saw that "tutorial" and work through Tonc instead. You'll actually learn something worthwhile.

http://www.coranac.com/tonc/text/
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#148263 - mog123 - Fri Jan 04, 2008 12:38 am

Can you just tell me what's wrong? I plan to do tonc after I do this one, So iIcan have a grasp of what is what.

#148265 - wintermute - Fri Jan 04, 2008 12:46 am

Just go straight to Tonc. That tutorial makes naive assumptions and teaches poor programming practices that will cause you a great deal of pain later.

Pay special attention to this section http://www.coranac.com/tonc/text/bitmaps.htm#sec-data with particular regard to section 5.4.3 - "Thou shalt not #include data or code"
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#148319 - mog123 - Fri Jan 04, 2008 4:17 pm

OK, I'm trying to do tonc, and I want to compile it using PN but after everything read and done I get this when I try to compile the first.c

> "C:\devkitPro\msys\bin\make.exe" -f first.c build
first.c:1: *** missing separator. Stop.

Here's the code:

Code:
int main()
{
    *(unsigned int*)0x04000000 = 0x0403;

    ((unsigned short*)0x06000000)[120+80*240] = 0x001F;
    ((unsigned short*)0x06000000)[136+80*240] = 0x03E0;
    ((unsigned short*)0x06000000)[120+96*240] = 0x7C00;

    while(1);

    return 0;
}

#148331 - Cearn - Fri Jan 04, 2008 4:55 pm

mog123 wrote:
OK, I'm trying to do tonc, and I want to compile it using PN but after everything read and done I get this when I try to compile the first.c

> "C:\devkitPro\msys\bin\make.exe" -f first.c build
first.c:1: *** missing separator. Stop.

...


`make' is a tool to run makefiles. `first.c' is a source file, not a makefile. Just open the pnproj file that comes with the demo, hit Alt+1 and it should work.

Fixed for silent code's remark.


Last edited by Cearn on Sat Jan 05, 2008 12:18 pm; edited 1 time in total

#148348 - silent_code - Fri Jan 04, 2008 8:32 pm

you most likely mean it *IS* a source file... :^)

#148401 - Cearn - Sat Jan 05, 2008 12:31 pm

silent_code wrote:
you most likely mean it *IS* a source file... :^)

Uhm ... yeah >_>.

noodle also mentioned that you can get a white screen if you don't set the display control (REG_DISPCNT) correctly. But somehow both of his replies got eaten. Also note that multiboot builds may not work with devkitARM r21 due to a linkscript problem, which can cause a white screen. See here for details. Easiest fix: don't use a multiboot build until DKA r22.

#148414 - wintermute - Sat Jan 05, 2008 3:13 pm

Cearn wrote:
But somehow both of his replies got eaten.


Heh, we were trying to move on from the stupid tutorial & use Tonc instead. I'm really not sure I see the point in correcting small errors in an example that took all the worst parts of other tutorials and combined them into one of the worst GBA tutorials on the net.

Quote:

Also note that multiboot builds may not work with devkitARM r21 due to a linkscript problem, which can cause a white screen. See here for details. Easiest fix: don't use a multiboot build until DKA r22.


hehe, yeah sorry about that, I missed some minor issues in binutils updates which made some things behave slightly differently.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog