Accessing arrays in high level inline assembly?

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

Accessing arrays in high level inline assembly?

2,377件の閲覧回数
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 返答(返信)

483件の閲覧回数
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

483件の閲覧回数
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 件の賞賛

483件の閲覧回数
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