Login
Back to forumReply to this topicGo to last reply

Posted By

SVS
on 2008-12-24
05:43:07
 How retrieve stack pointer

after used Basic SYS command?
I've put in UltimateMap locations for .A .X .Y and .SR ($7F2...$7F5) but not the .SP location.
Indeed I need for my current project the address of the byte with that info.
Thanx.

Posted By

JamesC
on 2008-12-24
09:27:11
 Re: How retrieve stack pointer

The Stack Pointer (.SP) is internal to the processor. It cannot be manipulated directly, only by adding or removing things from the stack. (Source: Commodore 16 Exposed, page 130)

However, since MONITOR is able to obtain .SP from the processor somehow (to display it), disassembly of MONITOR would point you to the method used.

Posted By

Csabo
on 2008-12-24
10:41:53
 Re: How retrieve stack pointer

You can use the TSX opcode, which will transfer the value of the stack pointer to the X register. Once it's in X, it's trivial to place it to wherever you need it. (The opposite - TXS - can used to directly change the value of SP.)



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024