Immediate adresses with expressions in inline assembler

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

Immediate adresses with expressions in inline assembler

1,562件の閲覧回数
slarti
Contributor I
hi group, it seems the inline assembler can't interpret something like struct { int baz; int foo; } bar[10]; #define OFFSET_FOO 2 __asm addd #bar + OFFSET_FOO ; I am getting a "C10000: Nothing more expected" which goes away when I remove the addition. Any hints how to make this assemble? regards, Mark
ラベル(1)
タグ(1)
0 件の賞賛
返信
3 返答(返信)

970件の閲覧回数
bigmac
Specialist III

Hello,

 

Have you tried placing the expression between parenthesis?

 

Regards,

Mac

 

0 件の賞賛
返信

970件の閲覧回数
slarti
Contributor I
0 件の賞賛
返信

970件の閲覧回数
CrasyCat
Specialist III

Hello

 

Did you try

__asm addd #bar:OFFSET_FOO;

 

 

Extract from the Compiler_HC12.pdf:

 

The inline assembler enables you to specify an offset from the address of a variable in order to access the low word of a long or a float

variable: Offset = ":" ConstExpr.
Variable = Ident {"." Ident}.

Below are some examples (assuming all variables are long):
LDY @g:2 ; Load Y with ((address of g) + 2)
LDX g:2 ; Load X with the value stored there
LDD r.f:2 ; Load D with low word of field f.

 

CrasyCat

0 件の賞賛
返信