Each key pressed in Learn mode will be entered into the current program step, and the program step (Program Counter, or P.C.) will advance to the next step. Pressing PRIME will return to step 0000. The "Set P.C." key may be used to go directly to any program step. Press Set P.C. followed by 4 digits to select a program step. This calculator has 1848 program steps, numbered 0000 through 1847.
Simulator Note: A program listing may be saved to a file by using the Save menu option in the printer window. Note, a program listing cannot be loaded back into the calculator, only tape image files may be loaded.
Also, programs may use the STOP code (SHIFT GO) to cause the program to stop. The user must press GO to continue running the program. This technique is often used to let the user enter variables for the program. It is common to CLEAR DISPLAY before the STOP, in order to make the request for input obvious. Alternatively, a special, meaningful, value may be in the display.
A program will also stop when it encounters an END PROG code. however, the program cannot be resumed after that (only started over at beginning), as the program counter is reset to 0000.
Also note, having more than one END PROG code in a program can be a problem. Not the least of which is for the List Program mode, but also for recording programs to tape. Normally, if a program has multiple exit points they will all be branches to a single END PROG, and that is at the physical end of all program codes. (See SEARCH/MARK in Programming Techniques). In other words, there should not be any program codes after an END PROG. This also includes any extended register data that might be stored in the program. In addition, the INS and DEL functions for editing programs will depend on a single END PROG code, at the end of all valid code.
Also note that one of the extended registers has same number as the END PROG code (09 14). Accessing this register (using RECALL/STORE) in a program will confuse List Program and the tape functions (and INS/DEL). This also applies to Program Print codes, and any "two step" program code that might have 09 14 as the second code.
Typically, the TRACE-ON sequence is keyed before pressing GO. Depending on the problem being debugged, the program may be canceled manually (pressing PRIME) or may stop on it's own. Then, the TRACE-OFF sequence is keyed to prevent accidental, unwanted, traces. The trace output is then examined to determine where the program goes off-plan. The STEP key may also be used to single-step the program while tracing.
Fine-grained debugging may require inserting steps in order to add TRACE-ON and TRACE-OFF codes. Be aware of what the presence of extra 09 14 (END PROG) codes in a program will do to the use of INS and DEL.
Replacing TRACE codes with GO codes is an easy way to temporarely change tracing, and strategically placed GO codes in a program may allow for easier adding of tracing later.
Simulator Note: On the original machine, tracing a program would often consume large amounts of paper. That is not a concern for virtual paper.