RTS returns to wrong place

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

RTS returns to wrong place

ソリューションへジャンプ
2,346件の閲覧回数
Vickyg
Contributor II
Hi,  I'm a newbie to assembler.  I've been tracing through my code trying to discover what is happening, and I've found that my RTS is returning to the wrong place.  Can anybody shed any light on a situation like this?
 
Thanks
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
740件の閲覧回数
Vickyg
Contributor II
Thank you both for your time and effort.  Just knowing that there were people out there on my side (me against the chip) was what I needed to get past my problem.  It turned out that I had changed chip sets and had missed that the add hx to a routines had moved and I was jumping in one point past where the stack pointer was incremented.  Stupid error on my part, but as a complete novice I was sure it was something like an overrun of the stack bounderies.
 
Thanks, your being there was very important to me.

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
740件の閲覧回数
kef
Specialist I
Is stack pointer (SP) pointing to RAM?
0 件の賞賛
返信
740件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
other things to check too
- stack is aligned, all the bytes added in the function have been removed before the RTS
- nothing in the function overwrites the return address
- the caller is using a JSR/BSR (and not CALL, for example)
- the stack is in RAM (as kef noted)
- the stack is allocated large enough.

Daniel
0 件の賞賛
返信
741件の閲覧回数
Vickyg
Contributor II
Thank you both for your time and effort.  Just knowing that there were people out there on my side (me against the chip) was what I needed to get past my problem.  It turned out that I had changed chip sets and had missed that the add hx to a routines had moved and I was jumping in one point past where the stack pointer was incremented.  Stupid error on my part, but as a complete novice I was sure it was something like an overrun of the stack bounderies.
 
Thanks, your being there was very important to me.
0 件の賞賛
返信