In C (99) I can use designated initializers to map array members to designated positions:
Code: Select all
enum Fruit_t {
APPLES,
ORANGES,
STRAWBERRIES = 8
};
static const int price_lookup[] = {
[APPLES] = 6,
[ORANGES] = 10,
[STRAWBERRIES] = 55
};
I completely understand that ca65 isn't C compiler. But sometimes we meet the same problem - to map "arrays" to designated enums:
Code: Select all
.scope loader
noarg = $0000
.endscope
.scope stage
.scope init
screen = $00
vars = $01
.endscope
.scope field
draw = $02
.endscope
.scope gameplay
select = $03
put = $04
.endscope
.scope animation
headup = $05
nohead = $06
.endscope
.scope system
end = $07
.endscope
.endscope
stage_storage:
.word loader_text, scene_game ; stage::init::screen
.word utility_init, loader::noarg ; stage::init::vars
.word utility_field, loader::noarg ; stage::field::draw
.word gameplay_select, loader::noarg ; stage::gameplay::select
.word gameplay_put, loader::noarg ; stage::gameplay::put
.word animation_headup, loader::noarg ; stage::animation::headup
.word animation_nohead, loader::noarg ; stage::animation::nohead
.word loader_dummy, loader::noarg ; stage::system::end
I know that this kind of tasks is better solved with external tools/preprocessors, but maybe there's something within ca65.
Thanks in advance.