In Assembly, I would write this:
Code: Select all
GAMESTATE_TITLE = $01
GAMESTATE_RUNNING = $02Code: Select all
#define GAMESTATE_TITLE 0x01
#define GAMESTATE_RUNNING 0x02O.k., I could declare a constant in C:
Code: Select all
const unsigned char GAMESTATE_TITLE = 0x01;
const unsigned char GAMESTATE_RUNNING = 0x02;Code: Select all
_GAMESTATE_TITLE:
.byte $01
_GAMESTATE_RUNNING:
.byte $02[/quote]
But that's the problem: A const would occupy actual space in the ROM. And this is what I don't want since my constants are just supposed to be possible values for a variable.
Sure, I want them to be declared in one location in the source code, so in case the value changes, I only have to change it in one location.
But in the actual compiled binary, all comparisons shall of course work directly with the numeric value (i.e. the value appears more than once in the ROM), not with a value at an address in the ROM.
Is there a possibility to do this?