GBDK libraries documentation
PrevChapter 2. The Gameboy as a TargetNext

Other

Preferably use the equality operators == and != over the inequality operators >, <, <= and =>. If the operands are signed or long then the code for inequality significantly more complex then for unsigned bytes which can be done in two operations.

Global variables that are initialised when they declared (for example int i = 0;) are put into the _DATA segment by lcc. This means that the variable cant be changed as for the GB the _DATA segment is in ROM. To avoid this, its best to initialise any global variables after declaring them i.e. use

int i;

int main(void)
{
    i = 0;
};
				
instead of the above code.


PrevHomeNext
Using global variablesUpAccessing hardware