Hi, Sayzer
I didn't look at it very closely ...
but I feel you can find your solution Here :
http://www.pbpgroup.com/modules/wfse...p?articleid=14
and once more ...
Thanks to Whom ????
D.A.R.R.E.L. !!!! ..........
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Darrel's clever method for the 16F type PICs creates a software stack - the real "stack" is not in program or data space and cannot be accessed (unless there is a back door that nobody knows about as Ski suggested)
I guess that SAYZER could create a software stack (as Alain is suggesting) and then manipulate it as needed? SAYZER, what are you trying to do and with what family of PIC?
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi, Paul
There's also something Doable ( depends on use ...) :
A GOSUB loads an address you can choose in the stack ...
if ending the SUB with a GOTO instead of a RETURN ... This address will stay as the new "return", "retfie" ... address.
That's used with the "RESUME Label" of PbP ...
I do not think "clearing" the stack would be really useful ... as a stack containing zeros will cause the device to reset ONLY its program on the first "return or so" met ...
Alain
Last edited by Acetronics2; - 9th February 2008 at 18:12.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
As Alain mentioned, there are potential side effects If I start playing directly with the registers.
Instead now, I am using flags being set to zero before going to a subroutine, and set the flags if something inside the subroutine is used.
Then at the end of the subroutine(s), I am using a kind of select case with "GOTO".
This way, I don't have any "return" address to care for.
This is a little code eating though; but a lot safer.
-------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
How about something like this:
Set your branch return location parameter, jump to the generic subroutine, branch back to wherever it came from. No calls, no gosubs, and so on...Code:main: code....code...code... addrreturn = 1 goto subroutine return1: addrreturn = 2 goto subroutine return2: addrreturn = 0 goto main subroutine: code....code....code branch addrreturn , [ return1 , return2, return3.................]
In the code, I jump from locations to locations really very fequently.
I am having a lot of return addresses.
_________________________________
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks