Execute an External Program as a Subroutine on the TI-84
It’s quite easy to have a program call and execute another program saved on your TI-84 Plus calculator, and then return to the original program to complete its execution of that program. One command accomplishes the processes of calling, executing, and returning: the prgm command (accessed by pressing [PRGM][ALPHA][x–1]).
The name of the program being called is placed directly after the command, as shown in the two screens here. Notice that there is no space between the command prgm and the name of the program.
After the externally called program is executed, the calling program continues to execute the commands that follow the prgm command provided that the externally called program does not encounter the Stop command. This command terminates both the called and calling programs.
As an example, if the program GOTOSTOP in the second screen here is called by your program, then when the program user enters a number greater than or equal to 1,000, both the calling and called programs terminate.
If you want the externally called program to return control to the calling program before it completes its execution, you do so by putting the Return command in the appropriate place in the externally called program.
As an example, consider the program GOTORTRN appearing here. GOTORTRN is simply the program GOTOSTOP with the Stop command replace by the Return command. If your program calls GOTORTRN, then when the program user enters a number greater than or equal to 1,000, the GOTORTRN program is terminated and the calling program continues to execute.
If a program containing a Stop command is called by another program, that command may terminate the execution of both programs. If the Stop commands in the called program are replaced with the Return command, then after the called program is executed, program control returns to the calling program.