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 > what mean this error:

#5570 - Link - Fri May 02, 2003 12:54 am

C:\devkitadv\bin>make.bat

C:\devkitadv\bin>path=c:\devkitadv\bin

C:\devkitadv\bin>gcc -o test4.elf test4.c
test4.c: In function `main':
test4.c:20: underscore in number

C:\devkitadv\bin>objcopy -O binary test4.elf test4.bin
objcopy: test4.elf: No such file or directory

the code is (the bold row id the line 20 with the error):

#include "gba.h"
#include "screenmode.h"
#include "sprite.h"
#include "sprite1.h" //header file ottenuto da pcx2gba

int main(void)
{

SetMode(OBJ_MAP_2D | MODE_3 | OBJ_ENABLE);
u8 sprite1Atributes = 0;

s16 x = 10;
s16 y = 10;
u16 char_number = 0;
u16 loop;

for(loop = 0; loop < 256; loop++)
OBJPaletteMem[loop] = sprite1Palette[loop];

sprites[sprite1Atributes].attribute0 = 256_COLOR | SQUARE | y;
sprites[sprite1Atributes].attribute1 = SIZE_64 | x;
sprites[sprite1Atributes].attribute2 = char_number;

int x_loop = 0, y_loop = 0, index = 0;

for(y_loop = 0; y_loop < 8; y_loop++)
{
for(x_loop = 0; x_loop < 256; x_loop++)
{
OAMData[x_loop + y_loop * 512] = sprite1Data[index];
index++;
} //end for x_loop
} //end for y_loop



}

#5571 - pollier - Fri May 02, 2003 2:18 am

Morning, Link :) [edit: yes, i see you are making more forum-worthy posts! congrats, link!]

Link wrote:
...

sprites[sprite1Atributes].attribute0 = 256_COLOR | SQUARE | y;
sprites[sprite1Atributes].attribute1 = SIZE_64 | x;
sprites[sprite1Atributes].attribute2 = char_number;

...


You might have counted the lines wrong, or started from 0, because 256_COLOR is probably your problem. Check to see if it matches the define in your headers.
_________________
(Works for me!)


Last edited by pollier on Sat May 03, 2003 3:54 am; edited 1 time in total

#5573 - Daikath - Fri May 02, 2003 2:54 am

Come on :), this WAS a valid question. Although some of his previous might have been shortsighted this was one a righteos one.
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?

#5575 - slapout - Fri May 02, 2003 3:42 am

Link wrote:

test4.c: In function `main':
test4.c:20: underscore in number


sprites[sprite1Atributes].attribute0 = 256_COLOR | SQUARE | y;


Variables in C can't begin with a number.

#5576 - OrangyTang - Fri May 02, 2003 8:58 am

slapout wrote:
Link wrote:

test4.c: In function `main':
test4.c:20: underscore in number


sprites[sprite1Atributes].attribute0 = 256_COLOR | SQUARE | y;


Variables in C can't begin with a number.


True, but #defines can, which seems to be how most bit flags are defined.

#5580 - Link - Fri May 02, 2003 11:36 am

thanx boys! i've correct the error! ;)

#6841 - hnager - Tue Jun 03, 2003 12:05 pm

I ran in to the same problem going through one of the many newbie tutorials - If I remember, the #define was COLOR_256 but it was implemented as 256_COLOR.