Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
I've got a problem when I try to compile my c code.
The first a follow the instruction on http://www.loirak.com/gameboy/gbprog.php and it worked.
So I try to write my own program using parts of other source code. My goal is just to display a picture. I ended up with that code :
-------------------------------------------------------------------------------------------------------------------------
#include <gb.h>
#include "nude_t.h" /*the tiles and palette entries*/
#include "nude_t.c"
#include "nude_m.h" /*the map (pointers to tiles)*/
#include "nude_m.c"
#include "nude_.h" /*the map's palette entries (pointers to palette)*/
#include "nude_.c"
UWORD nudePalCGB[] =
{
nudeTilesCGBPal0c0,nudeTilesCGBPal0c1,nudeTilesCGBPal0c2,nudeTilesCGBPal0c3,
nudeTilesCGBPal1c0,nudeTilesCGBPal1c1,nudeTilesCGBPal1c2,nudeTilesCGBPal1c3,
nudeTilesCGBPal2c0,nudeTilesCGBPal2c1,nudeTilesCGBPal2c2,nudeTilesCGBPal2c3,
nudeTilesCGBPal3c0,nudeTilesCGBPal3c1,nudeTilesCGBPal3c2,nudeTilesCGBPal3c3,
nudeTilesCGBPal4c0,nudeTilesCGBPal4c1,nudeTilesCGBPal4c2,nudeTilesCGBPal4c3,
nudeTilesCGBPal5c0,nudeTilesCGBPal5c1,nudeTilesCGBPal5c2,nudeTilesCGBPal5c3,
nudeTilesCGBPal6c0,nudeTilesCGBPal6c1,nudeTilesCGBPal6c2,nudeTilesCGBPal6c3,
nudeTilesCGBPal7c0,nudeTilesCGBPal7c1,nudeTilesCGBPal7c2,nudeTilesCGBPal7c3
};
void main()
{
set_bkg_palette( 7, 1, &nudePalCGB[28] );
set_bkg_palette( 6, 1, &nudePalCGB[24] );
set_bkg_palette( 5, 1, &nudePalCGB[20] );
set_bkg_palette( 4, 1, &nudePalCGB[16] );
set_bkg_palette( 3, 1, &nudePalCGB[12] );
set_bkg_palette( 2, 1, &nudePalCGB[8] );
set_bkg_palette( 1, 1, &nudePalCGB[4] );
set_bkg_palette( 0, 1, &nudePalCGB[0] );
set_bkg_data(0, 161,nudeTiles);
VBK_REG = 1;
set_bkg_tiles(0,0,nudeMapWidth,nudeMapHeight,nudePal);
VBK_REG = 0;
set_bkg_tiles(0,0,nudeMapWidth,nudeMapHeight,nudeMap);
}
--------------------------------------------------------------------------------------------------------------------------
I use this make.bat :
C:\gbdk\bin\lcc -c -o main.o main.c
C:\gbdk\bin\lcc -Wl-yp0x143=0xC0 -Wl-yp0x14A=1 -o main.gb main.o
--------------------------------------------------------------------------------------------------------------------------
I don't know if the code really work but everytime I try to compile my code, I've got this message :
"main.c1: error: gb.h: undocumented I/O error"
I reinstall GBDK but the problem is still here...
Offline
After some research, I change my compiler to gbz80-bg and I wrote a new make.bat :
C:\SDK\gbz80-gb\2-1-5\bin\lcc -Wa-l -Wl-m -o main.o main.c
C:\SDK\gbz80-gb\2-1-5\bin\lcc -Wa-l -c -o nude_t.o nude_t.c
C:\SDK\gbz80-gb\2-1-5\bin\lcc -Wa-l -c -o nude_m.o nude_m.c
C:\SDK\gbz80-gb\2-1-5\bin\lcc -Wl-m -Wl-yp0x143=0x80 -o main.gb main.o nude_t.o nude_m.o
The error messag change to :
C:\SDK\gbz80-gb\2.1.5\lib\crt0.o : cannot open.
C:\SDK\gbz80-gb\2.1.5\bin\Icc -Wa -l -c -o nude_t.o nude_t.c
C:\SDK\gbz80-gb\2.1.5\bin\Icc -Wa -l -c -o nude_m.o nude_m.c
C:\SDK\gbz80-gb\2.1.5\bin\Icc : can't find "main.o"
Offline
I tried again to compile other example programm with gbdk and the error still here :
error: gb.h: undocumented I/O error...
I need help :'(
Offline
sorry for the inactivity in this fourm i havent been on for a while
this looks like a problem with the compiler and not your program were are you downloading gbdk?
Offline
Should be <gb\gb.h>, not <gb.h>.
(Looks like I'm late to this party)
Offline
I let down C for a moment and tried to do it in assembler but I still want to try in C. So I look a the code one more time and try to add <gb/gb.h> and still got the error messages...
Offline
Ok folks ! I solved the godamn problem ! Now I can display picture and I'm happy ! Thanks for the help !
Offline