Inline Assembly

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Inline Assembly

3,156件の閲覧回数
UDP
Contributor I
Hello
 
Can someone give me a link to a document that describe deeply how to use the Inline Assembly ?
I want to access to c array in assembler ,assembler array ...
 
 
Thanks
 
 
 
ラベル(1)
0 件の賞賛
3 返答(返信)

445件の閲覧回数
UDP
Contributor I
I looked as this document it's similar to the help file.
I am looking how to use an arrays ,structures in Inline Assembly.
0 件の賞賛

445件の閲覧回数
CrasyCat
Specialist III
Hello
 
  For structure fields just use the  standard ANSI C notation
 
struct  {
long int a;
} mystruct;
   move.l mystruct.a,D0
For arrays the ANSI C notation (tab[2]) is not working. Mainly because array access often cannot be mapped to one single assembly instruction.
 
Here it really depends what you want to do.
Suppose you have an array of int and want to access element number 3 in the array, you can write:
   move.l D0,tab+(3*sizeof(int));
Now if you have a table of structure and want to access one field within an element of the structure you can for instance load A0 with the address of the desired element in the structure and then access the appropriate field using the struct construct (See manual referred in my last email).
For instance to access field x in fourth array element use the following:
  lea tab, A0
  adda.l #(4*sizeof(StrType)),A0
  move.l D0,struct(StrType.x)(A0)
StrType being defined as follows:
typedef struct StrType
{
 int x;
}StrType;
Anyway encoding of array access depends on what you intend to do.
I hope this helps.
 
CrasyCat
0 件の賞賛

445件の閲覧回数
CrasyCat
Specialist III

Hello

I assume you are using CodeWarrior for Coldfire V6.2. Am I right?

Did you look at the manual {Install}\Help\PDF\Targeting_ColdFire.pdf. Chapter 8 Inline Assembly describes the Inline assembly syntax and usage.

CrasyCat

0 件の賞賛