Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[PATCH] Support building hdbdos using lwasm

2013-04-28
2013-05-12
  • Tormod Volden
    Tormod Volden
    2013-04-28

    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.

     
    Last edit: Tormod Volden 2013-05-12
  • Tormod Volden
    Tormod Volden
    2013-04-28

    This patch makes the assembly code more "portable" and consistent:
    s/cond/IFNE
    s/ifne/IFNE
    s/else/ELSE
    s/endc/ENDC

     
    Attachments
  • Tormod Volden
    Tormod Volden
    2013-04-28

    Make makefile usable with other assemblers than mamou.

     
  • Tormod Volden
    Tormod Volden
    2013-05-06

    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.

     
    Last edit: Tormod Volden 2013-05-06
  • Tormod Volden
    Tormod Volden
    2013-05-12

    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.