Access variables in a C program from inline asm

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

Access variables in a C program from inline asm

1,657件の閲覧回数
rasmusnygaard
Contributor I
How do I access variables in a C program from inline asm. Now I access the variable by writing direct to the RAMadress from asm.
 
What do I write instead of XXX when I want to increment the testvar?
 
void main()
{
   char testvar;
 
   asm
   {
      inc XXX
   }
}
 
Best regards
Rasmus L. Nygaard, Denmark
ラベル(1)
0 件の賞賛
2 返答(返信)

357件の閲覧回数
rasmusnygaard
Contributor I
Thanks - it works. I did not even try this straight forward method, because of my experience from other compilers.
0 件の賞賛

357件の閲覧回数
CrasyCat
Specialist III

Hello

I assume you are using CodeWarriot for HC08. AM I right?

You just use the variable name as defined.

void foo(void)
{
   char testvar;
 
   __asm
   {
      inc  testvar
   }
}

CrasyCat

0 件の賞賛