Arakula / A09

A09 6800/6801/6809/6309/68HC11 Assembler
GNU General Public License v2.0
40 stars 8 forks source link

Errors using local labels #7

Closed raybellis closed 4 years ago

raybellis commented 4 years ago

Following (AFAICS) the syntax given in the RELASMB manual, this code:

    OPT TSC
    LDX #100
0   DEX
    BNE 0B

produces these errors:

A09 Assembler V1.42
test.asm(3) : error 1: Error in expression in "0       DEX"
1 error(s) in pass 1
test.asm(3) : error 1: Error in expression in "0       DEX"
test.asm(4) : error 3: Undefined label in "        BNE     0B"
2 error(s) in pass 2
Last assembled address: 0004

It seems like the parser is mis-categorising the numeric local label.

Arakula commented 4 years ago

Confirmed. This must have crept in when I added the isValidNameChar() function. Some fine day, I'll add a regression test suite ... Here's an update that should work again (does here with your short example).

raybellis commented 4 years ago

Hi Hermann - that works with TCS mode, but not your extended mode.

(my code uses the latter, but I sent an example with TCS to show the regression against "standard" syntax).

I've attached a more extensive sample that uses extended mode.

p.s. I'm very happy to test from git branches rather than .zips if that works for you.

Arakula commented 4 years ago

OK, here is an even more relaxed version.

Regarding your p.s. - that would interfere with my normal work flow (which involves checking in changes from exactly one development PC, which is at home).

raybellis commented 4 years ago

Thanks again - that's working nicely :)

raybellis commented 4 years ago

I spoke too soon - I'm afraid this causes another regression, with immediate decimal constants, e.g.

        LDX     #10000    ; $2710

generates a value equal to the current program counter instead of an immediate constant. Here's a diff of the hex dump of my binary output showing the issue:

 0000c440  01 4f b7 7f 99 39 86 38  ce 00 00 09 26 fd b7 40  |.O...9.8....&..@|
-0000c450  00 ce 27 10 09 26 fd b7  40 00 ce 27 10 09 26 fd  |..'..&..@..'..&.|
+0000c450  00 ce c4 51 09 26 fd b7  40 00 ce c4 5a 09 26 fd  |...Q.&..@...Z.&.|
 0000c460  b7 40 00 bd c8 8c b7 40  00 bd c8 8c 86 0c b7 40  |.@.....@.......@|
Arakula commented 4 years ago

OK, here's one more ...

raybellis commented 4 years ago

Looking good so far, thanks :)