Shop OBEX P1 Docs P2 Docs Learn Events
gosub/return — Parallax Forums

gosub/return

hmlittle59hmlittle59 Posts: 404
edited 2008-02-20 05:49 in BASIC Stamp
hello everyone,

I've seen the problem for a couple of days and spent all day today trying to track it down. I've commented out all GOSUBs in-between and it still happens...Why would my program reboot from a 'RETURN'? Does this only happen when there is not a match?
nothing left on the stack?

1) I can repeat the problem, but nothing seems to fix it.
2) I've reloaded the program over and over again
3) I use an LCD, but have put debug statements in to help track it down
4) I load the program, go to the failing routine, and it just repeats.


Any suggestion of any kind...even the (DA did you look at this or DA try this)....what a way to spend a day off work.[noparse]:)[/noparse]
On my way to get printer ink.
thanks
hmlittle59

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-20 02:18
    Generally, a program reboots at a RETURN because there was no matching GOSUB. Don't forget that executing code "falls through" from one section to another unless there's a GOTO or RETURN at the end of the section. Also remember that GOSUBs can be nested only so far.

    Go through your program, carefully matching up GOSUBs and RETURNs (literally ... print out the program and draw lines. Make sure there are no program sections that "fall through" unless you want it, then mark it on the listing).
  • hmlittle59hmlittle59 Posts: 404
    edited 2008-02-20 03:33
    thanks Mike,

    I had to purchase a refill kit for my printer because Walmart was all out...what a mess....now lets see if it will print...thanks for the advise.

    hmlittle59
  • hmlittle59hmlittle59 Posts: 404
    edited 2008-02-20 05:49
    Ok My Bad,

    After making a big mess of refilling the ink cartridge, then doing a print out i found the fix within 10 mins. It was from the originating routine...( ON work GOSUB......)...I still think it should have worked as is. I changed it to GOTO and it seems to be working. I'll test some more to be sure. thanks


    hmlittle59
Sign In or Register to comment.