spasm-ng icon indicating copy to clipboard operation
spasm-ng copied to clipboard

Excess spaces before macro parameters cause parameters to be ignored

Open tari opened this issue 1 year ago • 1 comments

When a space is inserted between the name of a macro and its parameter list, the parameter list is silently ignored. Minified example:

#define bcall(xxxx) rst 28h \ .dw xxxx
    bcall ($1234) ; Note the space here

The resultant listing drops the .dw completely, and no error is reported:

1 00:0000 - - - - #define bcall(xxxx) rst 28h \ .dw xxxx
2 00:0000 EF - - - bcall ($1234)

This should instead assemble to EF3412, as seen if we remove the extra space:

1 00:0000 - - - - #define bcall(xxxx) rst 28h \ .dw xxxx
2 00:0000 EF 34 12 - bcall($1234)

This was reported by a user in https://www.cemetech.net/forum/viewtopic.php?t=19221

tari avatar Aug 30 '23 01:08 tari

I have hit this problem about 5 times now, even after figuring it out the first time. Every time I hit it, I spend hours searching for this little typo in my code.

bxparks avatar Jun 20 '24 00:06 bxparks