New users, new issues, hooray! So, this code does bad things: delay set 9 .print "delay=" delay jsr EndNopTable-(2*(delay-9)) delay set delay-9 .print "delay=" delay jsr EndNopTable-(2*delay) jsr EndNopTable-(delay*2) jsr EndNopTable-delay-delay delay set (delay*2) .print "delay=" delay jsr EndNopTable-delay jsr EndNopTable-0 jsr EndNopTable ; jsr abs.l => 20/5 cycles ; jsr EndNopTable + rts = 5+4=9 nops NopTable: dcb.w 100,$4e71 ; 4/1 x100 EndNopTable: rts ; 16/4 Basically, "EndNopTable" is unknown when the expression evaluator reaches the jsrs. So the expressions are recorded so they can be passed to evexpr() during fixups.... except that "delay" has changed during the assembly pass, so the fixups go haywire. Yeah so.... really weird case there. I classified it as a bug because the user gets 0 feedback about this. They expect the code to be assembled correctly. I can think of 2 ways to fix this a) Somehow keep track that the symbol has been SET'd more than once and emit a warning during fixups. (a bit meh) b) During the recording of the expression, actually sit down and evaluate all defined symbols instead of blindingly copying/marking them (I can't remember right now what happens) I think (b) is the way to go - this will increase robustness in general and probably shouldn't be too hard to implement. I'll take a look at it tomorrow as I fear I'll do something really bad if I check it out now :)
Created attachment 154 [details] Behold! Ok, here's the proposed fix. It certainly cures the above problems. It also uncovered an issue in the regression tester: Drone is also generating tables that hit a similar issue. But those tables are never used, so the issue went unnoticed all these years! This convinced me even more that this fix is needed.
Thanks for the patch! :-)