Okay, I found a bug in my code caused by (me) calling subroutines (GoSub) and then using a "GoTo" within that subroutine rather than always using the Return. After a certain number of calls to that subroutine, everything went haywire.
Lucky I remembered seeing a post on earlier this forum about NOT doing that with 18FXXX, and was able to find the problem and fix it. ....after a tedious adventure in creating a hand-drawn flowchart to map my code and find the missing Returns.
My QUESTION is.....could I simply insert a "STKPTR = 0" in order to reset the stack and compensate for a few "illegal" GoTos? I would place this at the TOP of my code allowing me to immediately jump back to the "MainLoop" of the program without having to Return from the current subroutine.
This would still be useful in the interest of speed, to not have to back out of a number nested subroutines. I know it's unorthodox...but will it work?
Bookmarks