I know it's ugly, but I'm working on a program in BASIC where I need to POP the last GOSUB off the stack. I've tried kludges like setting flags to designate GOTO vs RETURN, but I think POP would be better.
I've tried Googling comp.sys.cbm, no luck.
Assembly preferred, mainly so I can study and learn?
Edit: I know where the stack is, there is a value which says "Here is a GOSUB" and four more bytes after that. My assumption is that you would PLA stuff from the stack including and after that byte.
Is there a stack depth byte which needs to be decremented, too?
Edit: TSX and TXS opcodes exist, okay, hmm...
Last Edit: Oct 18, 2008 18:55:13 GMT -5 by Pinacolada
Can you share with us here? I looked into this briefly, but couldn't find a good answer. I wasn't sure if there was more to it than just clearing the info off the 6502's stack (like, if BASIC kept other related info elsewhere).