Sorry for digging up this old thread. While there were plenty of unclear points they were mostly sorted so I don't want to address everything unless someone asks for a clarification.
There's one misunderstanding however which bothered me for years. Worse it appears to spread so I'd like to address it at the source here.
Code:
basic.asm:1558:19: error: invalid operands to multiply '*' 'address' and 'int'
CMP #[TK_TAB-$80]*2 ; compare normalised token * 2 with TAB
^
I have to admit this message was a bit low-level and misleading. Later versions (like the old 1.53.1515 released a month after the incident) print this improved message instead:
Code:
basic.asm:1558:19: error: multiply '*' of address '[43]' and int '2' not possible
CMP #[TK_TAB-$80]*2 ; compare normalised token * 2 with TAB
^
An address for 64tass is a (numeric) value together with indexing, immediate and indirection operations. This is somewhat different from normal use where it usually stands for a numeric value identifying a memory location.
In this case the address is [TK_TAB-$80] which can't be multiplied as the numeric value 43 had already an indirect long addressing mode applied on. The immediate mode operation haven't joined in yet due to precedence rules.
Probably I could make the expression parser more complicated by special casing brackets to not mean indirection here but I won't. It wouldn't help either as parentheses are used for expression grouping not brackets.
The parser is generic and accepts any random (but syntactically correct) addressing modes even if it turns out that it does not work with the opcode it or it's just nonsense.
There are various design reasons why addresses for 64tass are more than just simple numbers. One of the easiest ones is to support register based addresses:
Code:
tmp = 1,s ; indirection is only valid at opcodes but indexing is fine here
lda tmp+1 ; lda 2,s