Skip to main content
Visitor II
May 25, 2007
Question

assembly in metrowerk

  • May 25, 2007
  • 3 replies
  • 857 views
Posted on May 25, 2007 at 23:51

assembly in metrowerk

    This topic has been closed for replies.

    3 replies

    jasonnganAuthor
    Visitor II
    May 24, 2007
    Posted on May 25, 2007 at 01:13

    I have to convert the source code form Metrowerks to cosmic. I have some probrlem for following 2 lines code :

    1. LD abc:21,A

    2. LD X,#abc:7

    Could you please explain the code meaning?

    The sample code is show as following:

    void abc()

    {

    Byte abc[34];

    asm LD abc:21,A

    asm LD X,#abc:7

    }

    Visitor II
    May 25, 2007
    Posted on May 25, 2007 at 06:42

    Hi,

    LD abc:21,A

    means to load the memory with the address of abc+21 with A.

    If you read a Cosmic .ls-file you'll find something like

    ld _abc+21,a

    LD X,#abc:7

    means to load X with the address of abc+7. In Cosmic syntax you'll get

    ld x,#_abc+7

    or

    ld x,#low(_abc+7)

    But unfortunately I don't know any way to address local objects using the inline assembler at Cosmic.

    btw.: if you want to convert HW code to Cosmic there is a helpful application note at the Cosmic site

    http://www.cosmicsoftware.com/pdf/Cosmic_vs_MW_ST7.pdf

    Regards,

    WoRo

    jasonnganAuthor
    Visitor II
    May 25, 2007
    Posted on May 25, 2007 at 23:51

    Thank you for your help!