PDA

View Full Version : Is a 'GOTO' Or a 'GoSub'?



FromTheCockpit
- 1st August 2013, 22:37
If I have a statement like below:

I2C_Routine:
I2CWRITE SDA,SCL,$36,[Loc], Fail
Return

The jump to the label Fail is executed as a Goto or a GoSub instruction at the end of the above statement in case I2C fails?

I am trying to avoid stack errors, my code does a 'GoSub I2C_Routine', I will have a stack left un'RETURN'ed in case the fail is executed as a goto. What should I do in this case? I don't think I can put a return at the end of the Fail function in case it is a goto jump. I hope I made my question clear.

Darrel Taylor
- 1st August 2013, 23:27
It is a GOTO.

But you can put a RETURN after the Fail routine.
It will return to the same point that called the I2C_Routine.