fachat / xa65

6502/65816 cross assembler
http://www.floodgap.com/retrotech/xa/
55 stars 8 forks source link

Undef'd labels with offset #17

Open fachat opened 5 months ago

fachat commented 5 months ago

I want to replace things like:

#define FOO  BAR+1

with

FOO   = BAR+1

Unfortunately this does not work if BAR is an undefined label that is resolved during late binding.

The reference could be saved in the relocation / undefined labels list without problem, but xa creates an error when it encounters this definition of FOO.

Instead: xa should note that FOO is undefined, and refers to BAR with an offset. When FOO is used, BAR+offset should be substituted.

This seems to work like a pre-processor statement, but the difference is that FOO is a proper label with segment, and in the listing FOO should still be printed instead of BAR+offset