While assembling a TI-83 Plus series application with spasm-ng, I discovered that one of my macros (defined in terms of other macros using #define) was taking on different values when used in different places. After some digging, it seems that the values differed depending on whether or not one of the macros used in the definition was evaluated before substitution. To illustrate the problem, I've attached a small example that exhibits the same behavior, along with a listing file that shows the discrepancy. (The listing file was generated by SPASM-ng v0.5-beta.3 - Beta Release, the most recent release at the time of this writing.)
Assuming that evaluation before substitution is the desired behavior, this is easy enough to work around by simply putting otherwise ambiguous macro references in parentheses. For example, replacing product with (product) in the definition of result on line 13 of the example produces the desired result. However, I think it might save development time to have macros always evaluate to the same value. Any ideas or feedback would be appreciated.
Hi there!
While assembling a TI-83 Plus series application with spasm-ng, I discovered that one of my macros (defined in terms of other macros using
#define
) was taking on different values when used in different places. After some digging, it seems that the values differed depending on whether or not one of the macros used in the definition was evaluated before substitution. To illustrate the problem, I've attached a small example that exhibits the same behavior, along with a listing file that shows the discrepancy. (The listing file was generated bySPASM-ng v0.5-beta.3 - Beta Release
, the most recent release at the time of this writing.)Assuming that evaluation before substitution is the desired behavior, this is easy enough to work around by simply putting otherwise ambiguous macro references in parentheses. For example, replacing
product
with(product)
in the definition ofresult
on line 13 of the example produces the desired result. However, I think it might save development time to have macros always evaluate to the same value. Any ideas or feedback would be appreciated.Thanks, Andrew Henry
Attachments: listing.txt source.txt
P.S.: Sorry for closing and re-opening this issue; I accidentally hit Ctrl+Enter before I finished writing it.