Here is a simple exercise to review the Stack:
Code:10: Main: 20: DO 30: IF PORTB.1 = 1 THEN 40: GOSUB CheckIn ' Stack Contains 40 50: ENDIF 60: LOOP 70: CheckIn: 80: IF PORTB.2 = 1 THEN 90: GOTO Verify ' Stack Still Contains 40 100: ENDIF 110: RETURN 120: Verify: 130: IF PORTB.1 = 1 THEN 140: RETURN ' This RETURN jumps to the address in the Stack + 1 (address), so the point of RETURN = 50 150: ELSEIF PORTB.2 = 1 THEN 160: GOTO NameCalling ' Stack Still Contains 40 170: ENDIF 180: RETURN




Bookmarks