cancel
Showing results for 
Search instead for 
Did you mean: 

assembly in metrowerk

jasonngan
Associate II
Posted on May 25, 2007 at 23:51

assembly in metrowerk

3 REPLIES 3
jasonngan
Associate II
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

}

wolfgang2399
Associate II
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

jasonngan
Associate II
Posted on May 25, 2007 at 23:51

Thank you for your help!