Arakula / dasmfw

The DisASseMbler FrameWork
GNU General Public License v2.0
13 stars 4 forks source link

Decimal/Hex negative number format causing different A09 to compile different binary #2

Closed phillipeaton closed 3 years ago

phillipeaton commented 3 years ago

If my info file creates this

        LDY     INDX2
AT5     LDA     -$80,Y
        LEAY    $01,Y

and I update the info file with this

decimal 0EEB-0FD7

then I get this

        LDY     INDX2                   ; 0EF7  Load index
AT5     LDA     --128,Y                 ; 0EFB  Get direction and increment pointer
        LEAY    1,Y                     ; 0EFE 

which, when compiled by A09, gives me a different binary: (left = --128, right = -$80)

image

This double negative formatting looks dubious to me.

Note, the two assembles were done several days apart, but from what I can see, the list file created by a09 stayed the same for both assembles, meaning dasmfw could be creating dubious formatting and a09 may not be handling the dubious formatting correctly between the list and bin file.

I hope this makes sense. Let me know if this is expected behaviour or if I can help with further test cases.

Thanks!

Arakula commented 3 years ago

Hmmm. OK, I created a little info file:

option dasm 6809
option conv off
label 112 INDX2
patch ef7 10 be 01 12 a6 a8 80 31 21
dec efd-eff

that should correspond to your problem; when run with dasmfw -info issue2.nfo, it gives the same (incorrect) output:

        LDY     INDX2                   ; 0EF7: 10 BE 01 12    '....'
        LDA     --128,Y                 ; 0EFB: A6 A8 80       '...'
        LEAY    1,Y                     ; 0EFE: 31 21          '1!'

I'll look into that tomorrow (22:50 here as I'm writing this, not the best time for a debugging session). -$80 should be output as -128 in decimal.

A09, when confronted with "--128", does the reasonable thing and converts it into a 16 bit value of 128, as +128 can't be represented in 8 bit signed.

Arakula commented 3 years ago

OK. Fixed. .zip including .exe can be found at https://www.hermannseib.com/programs/beta

phillipeaton commented 3 years ago

Tested and working, thanks for the update 👍