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

expression parsing is broken in some 68k addressing modes #1

Closed Awuwunya closed 3 years ago

Awuwunya commented 3 years ago

AS has a big issue when it comes to expression parsing as a part of addressing modes such as xxx(pc/An, Xn) and I believe xxx(pc/Xn) as well, where expressions confuse the assembler. Here are a few examples of me recreating issues (DO NOTE, that using a temporary variable makes these codes work!)

> > >AMPS/code/68k Commands.asm(17): error: addressing mode not allowed on 68000
> > >       jmp .comm-$80(pc,d1.w)  ; jump to appropriate handler
> > >AMPS/code/68k Commands.asm(17): error: addressing mode not allowed here
> > >       jmp .comm-$80(pc,d1.w)  ; jump to appropriate handler
> > >AMPS/code/68k Commands.asm(19): error: unknown function
> > > 4)
> > >       jmp (.variable*4)(pc)   ; jump to appropriate handler
> > >AMPS/code/68k Commands.asm(19): error: addressing mode not allowed here
> > >       jmp (.variable*4)(pc)   ; jump to appropriate handler
flamewing commented 3 years ago

I have actually been working on that one: see fb7feb374d and 59b7c4ee82 for example. The version that will be generated tonight will have these in.

flamewing commented 3 years ago

As far as I can tell by my tests, this one is fixed. I tried all of the following:

.tmp: set   ((MainLbl.sublbl)-MainLbl)
    lea (MainLbl.sublbl)-MainLbl(a0),a0
    lea ((MainLbl.sublbl)-MainLbl)(a0),a0
    lea MainLbl.sublbl-MainLbl(a0),a0
    lea .tmp(a0),a0
    lea $0016(a0),a0
; somewhere else
MainLbl
    dc.l    0, 0, 0, 0
.sublbl:

They all generate the correct code. I also tested a LOT of variants of 68k addressing modes, including later models. If anyone finds a broken addressing mode, please file a new issue.