flamewing / asl-releases

Improved/bugfixed version of Alfred Arnold's The Macro Assembler AS
http://john.ccac.rwth-aachen.de:8000/as/
GNU General Public License v2.0
20 stars 2 forks source link

Fix bogus 'short address not allowed' errors #25

Closed Clownacy closed 6 months ago

Clownacy commented 1 year ago

This bug could be triggered with the following code:

    CPU 68000
    phase $200000
    move.w  (dummy).w,d0
dummy = $100

What happens is that, when an undefined symbol is encountered in the first pass, it is temporarily assigned the value of the program counter.

In the above example, the dummy variable is undefined at the time that the line move.w (dummy).w,d0 is encountered, causing it to be temporarily evaluated to $200000. Since $200000 is not within short addressing range, the assembler throws an error, despite the actual value of the dummy variable being $100, which is within the range.

To fix this, I have made it so that the short addressing range check is not performed if the symbol is undefined. Note that this does not prevent the error from occurring when the true value of the variable is also out-of-range, as the range check is performed again when the line is re-evaluated in a later pass.

This fixes the bug that I described in #3.