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.
Does anyone recognize this error and or know how to fix it?
Thanks in advance!~
"lcc31121.asm:3407: Error: <r> relocation error"
Last edited by alchemypotofficial (2020-06-29 19:23:00)
Offline
that error means, that assembler fails to compile the asm-code generated by C compiler from your source. the manual says:
(r) Relocation error: logic operation attempted on a relocatable term, addition of two relocatable terms, subtraction of two relocatable terms not within the same programming area or external symbols.
it's hard to tell what's wrong in your case without code and versions of gbdk/sdcc.
Offline
Thanks for the reply, I think that error code explanation gives me a hint at what's actually going on. I will post more about what my problem exactly is when I find the offending code. Cheers!
Offline
I believe the error was caused by doing addition or subtraction from within the index brackets of a matrix. Doing arithmetic outside of the array and then passing the variable into the index seems to fix this problem.
This was the offending code -
extern const unsigned char Tileset_1_Map[42][4];
...
void Draw_Tile8(UBYTE tile_x, UBYTE tile_y, UBYTE tile_num)
{
set_bkg_tiles(tile_x, tile_y, 2, 2, Tileset_1_Map[tile_num]);
}
...
Draw_Tile8(load_pos_x, i, map->data[map_x + map_y]);
map_y += map_size_x;
Last edited by alchemypotofficial (2020-06-29 19:27:19)
Offline
what gbdk version do you use?
Offline
GBDK 2.95-3, the last version updated. Is there actually a newer release besides GBDK 2020? I've been planning on switching to GBDK 2020 but haven't gotten around to it.
Last edited by alchemypotofficial (2020-06-30 04:04:53)
Offline
you should switch to GBDK-2020, that problems you have because of ancient SDCC. that's not the only bug in it. you may find the latest release of GBDK-2020 here: https://github.com/Zal0/gbdk-2020/releases
as an alternative, you may use gbdk-n with the standalone SDCC, but there are problems with the library and no memory banking support
Offline