Immediate adresses with expressions in inline assembler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Immediate adresses with expressions in inline assembler

954 Views
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
Labels (1)
Tags (1)
0 Kudos
3 Replies

362 Views
bigmac
Specialist III

Hello,

 

Have you tried placing the expression between parenthesis?

 

Regards,

Mac

 

0 Kudos

362 Views
slarti
Contributor I
0 Kudos

362 Views
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 Kudos