Immediate adresses with expressions in inline assembler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Immediate adresses with expressions in inline assembler

1,546 次查看
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 回复数

954 次查看
bigmac
Specialist III

Hello,

 

Have you tried placing the expression between parenthesis?

 

Regards,

Mac

 

0 项奖励
回复

954 次查看
slarti
Contributor I
0 项奖励
回复

954 次查看
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 项奖励
回复