Accessing arrays in high level inline assembly?

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

Accessing arrays in high level inline assembly?

2,343 Views
FC
Contributor III
Hi,
 
I tried, but keep getting errors trying to access arrays in inline assembly.
 
the debugger gives an error on this:
 
asm {
.
..
lda  @table, x
 
}
 
It doesn't add the offset in x to the adress of table.     
 
 
Labels (1)
Tags (1)
0 Kudos
3 Replies

449 Views
CompilerGuru
NXP Employee
NXP Employee
Can you give a more complete example and description of what you are doing, what you expect to see and what you get?
What error do you get, and which tool do you get this error from?

If from the debugger, from the simulator or which hardware connection?

Daniel

449 Views
FC
Contributor III

 

I am trying to write the inline assembly equivalent to:

 TPMC0V = table[duty_cycle];

The simulator gives an error of "trying to access uninitalized location..."  The location is not within the table array.

Note:  Inline assembly compiles, but simulation fails with this:

lda @table, x      

the x register contains the address offset

0 Kudos

449 Views
CompilerGuru
NXP Employee
NXP Employee
And the H register?
It is used as high byte part of the H:X register pair, implicitely in
"lda @table, x".
What address is the simulator accessing, what is in X & H and where is the table located? Do you see how the accessed address is computed?

Maybe a full sample showing the setup would make things clearer.

Daniel