Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
With these two patches, we can build either with lwasm or mamou. I have noticed the binaries are not identical, this is due to a bug in mamou when it comes to indirect addressing, for example, "ldb ,x" gives E6 84 on lwasm, but E6 00 ( = ldb 0,x) on mamou.
EDIT: The bug is likely rather in lwasm, see below.
EDIT2: It is an optional feature in lwasm, see below.
This patch makes the assembly code more "portable" and consistent:
Make makefile usable with other assemblers than mamou.
I apologize for suggesting above that there was a bug in mamou. I have checked the source better and it actually is "ldb SYMBOL,x" where SYMBOL is 0 (zero). So it seems like mamou is correct in assembling this into "ldb 0,x" thus a 5-bit (but zero) offset. lwasm "optimizes" this into "ldb ,x" but I am not sure that it is correct. The practical difference is that "ldb 0,x" takes one more cycle to execute than "ldb ,x", and this could matter in for instance a timing-sensitive tight I/O loop.
This is not a bug in lwasm either, but an optional feature. This optimization is enabled by the pragma "index0tonone" which is enabled by default. We can use "noindex0tonone" to disable it and obtain the exact same result as with mamou.