Asm-02 treats underscore as a word separator for #defines


David Madole
 

It looks like Asm-02 treats underscore as a word separator in parsing #define expansions which is different than historical precedent and what Rc/Asm does:

 

# cat test.asm

#define A 1

#define B 2

#define A_B 3

 

ldi A_B

 

# asm02 -l -b test.asm

[    5] 0000: f8 01        ldi 1_2

 

Note how the argument “A_B” has the “A” and “B” separately expanded rather than expanding the whole word.

 

Besides this simple example, this behavior also breaks the definitions in things like bios.asm which use underscores in the #define names.

 

Also, it seems like “1_2” should not be parsed as an expression value of “1” without any error. Shouldn’t the trailing “_2” garbage generate a warning at a minimum?


David

 


Mike Riley
 

For some odd reason I was unable to duplicate this one, but I went ahead and added _ to the alpha set when it comes to checking #define replacements, so should resolve this.
    Mike


From: cosmacelf@groups.io <cosmacelf@groups.io> on behalf of David Madole <david@...>
Sent: Friday, September 10, 2021 5:57 PM
To: cosmacelf@groups.io <cosmacelf@groups.io>
Subject: [cosmacelf] Asm-02 treats underscore as a word separator for #defines
 

It looks like Asm-02 treats underscore as a word separator in parsing #define expansions which is different than historical precedent and what Rc/Asm does:

 

# cat test.asm

#define A 1

#define B 2

#define A_B 3

 

ldi A_B

 

# asm02 -l -b test.asm

[    5] 0000: f8 01        ldi 1_2

 

Note how the argument “A_B” has the “A” and “B” separately expanded rather than expanding the whole word.

 

Besides this simple example, this behavior also breaks the definitions in things like bios.asm which use underscores in the #define names.

 

Also, it seems like “1_2” should not be parsed as an expression value of “1” without any error. Shouldn’t the trailing “_2” garbage generate a warning at a minimum?


David

 


David Madole
 

Odd you weren’t able to reproduce it although I do notice in my email the space is missing in front of the “ldi” which I think might have been automatically removed by my email client in it’s attempt to “help” me.

 

But the fix does indeed work:

 

# asm02 -l -b test.asm

[    5] 0000: f8 03        ldi 3

 

Thanks.

 

David

 

 

From: cosmacelf@groups.io <cosmacelf@groups.io> On Behalf Of Mike Riley
Sent: Sunday, September 12, 2021 1:05 PM
To: cosmacelf@groups.io
Subject: Re: [cosmacelf] Asm-02 treats underscore as a word separator for #defines

 

For some odd reason I was unable to duplicate this one, but I went ahead and added _ to the alpha set when it comes to checking #define replacements, so should resolve this.

    Mike

 


From: cosmacelf@groups.io <cosmacelf@groups.io> on behalf of David Madole <david@...>
Sent: Friday, September 10, 2021 5:57 PM
To: cosmacelf@groups.io <cosmacelf@groups.io>
Subject: [cosmacelf] Asm-02 treats underscore as a word separator for #defines

 

It looks like Asm-02 treats underscore as a word separator in parsing #define expansions which is different than historical precedent and what Rc/Asm does:

 

# cat test.asm

#define A 1

#define B 2

#define A_B 3

 

ldi A_B

 

# asm02 -l -b test.asm

[    5] 0000: f8 01        ldi 1_2

 

Note how the argument “A_B” has the “A” and “B” separately expanded rather than expanding the whole word.

 

Besides this simple example, this behavior also breaks the definitions in things like bios.asm which use underscores in the #define names.

 

Also, it seems like “1_2” should not be parsed as an expression value of “1” without any error. Shouldn’t the trailing “_2” garbage generate a warning at a minimum?


David