Accessing arrays in high level inline assembly?

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

Accessing arrays in high level inline assembly?

2,520 次查看
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.     
 
 
标签 (1)
标记 (1)
0 项奖励
回复
3 回复数

626 次查看
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

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

626 次查看
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