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.
Hi, i'm new to GB development, so my question is probably pretty stupid and apologize for that, i'm trying to send debug messages for bgb in c, i found on this forum an user that suggested a macro like this:
#define BGB_MESSAGE(lbl, message_text) \ __asm \ ld d, d \ jr lbl \ .dw 0x6464 \ .dw 0x0000 \ .ascii message_text \ lbl: \ __endasm
but when i try to use it i just get :
parse error before ld
i never used lcc before so maybe i'm missing some options.
does anyone know how to fix this? i noticed i don't seem to be able to do any inline assembly at all.
Thanks in advance,
Tommaso.
Last edited by tommaso (2020-06-14 15:51:33)
Offline
the problem seem not to be in the macro itself, but in the way, how you use that macro.
Offline
you must use that macro this way:
1. inside a function, with ';'
2. lbl must be the numeric value ended by the $ symbol. that numeric label must not intersect with other local labels, generated by sdcc, choose some big numbers.
3. the message must be a constant string
example:
void main(void)
{
BGB_MESSAGE(100500$, "HELLO, WORLD");
}
ps: just use the latest GBDK-2020 https://github.com/Zal0/gbdk-2020/releases , there are better BGB macros in gb/bgb_emu.h.
Last edited by toxa (2020-06-14 18:45:51)
Offline
toxa wrote:
you must use that macro this way:
1. inside a function, with ';'
2. lbl must be the numeric value ended by the $ symbol. that numeric label must not intersect with other local labels, generated by sdcc, choose some big numbers.
3. the message must be a constant string
example:
void main(void)
{
BGB_MESSAGE(100500$, "HELLO, WORLD");
}
ps: just use the latest GBDK-2020 https://github.com/Zal0/gbdk-2020/releases , there are better BGB macros in gb/bgb_emu.h.
thank you very much! updating gbdk solved my problem, i was using the 2000 version, i didn't know someone updated it!
Offline