Reference Section


Use this section as a source of reference information on changing the order of program execution within a program. For information on transferring execution to a program stored in the calculator's file space or in a Constant Memory™ cartridge, refer to the "File Operations" chapter of this guide.


Label

[ 2nd ] [ LBL ] aa

Labels a program segment. Labels are used in a program to mark locations for transfer functions. [ 2nd ] [ LBL ] is ignored as a keyboard command.

List Labels

[ LIST ] { LBL }

Lists labels used in program memory. The listing format shows the program address followed by the label name. As a keyboard command, { LBL } lets you start the label search for the list at the beginning of program memory or at the current location of the program counter. As a program instruction, { LBL } always starts the label search for the list at program address 0000.

The instruction mnemonic for [ LIST ] { LBL } is LL.

Go To Label

[ 2nd ] GTL aa

As a program instruction, [ 2nd ] [ GTL ] transfers execution to the instruction following label aa in the current program or file. As a keyboard command, [ 2nd ] [ GTL ] sets the program counter to the instruction following label aa in program memory, but does not start program execution.

Go To

[ INV ] [ 2nd ] [ GTL ] nnnn

As a program instruction, [ INV ] [ 2nd ] [ GTL ] transfers execution to program step nnnn in the current program or file. As a keyboard command, [ INV ] [ 2nd ] [ GTL ] sets the program counter to step nnnn in program memory, but does not start program execution.

The instruction mnemonic for [ INV ] [ 2nd ] [ GTL ] is GTO.

Setting the Program Counter

You can use [ 2nd ] [ GTL ] and [ INV ] [ 2nd ] [ GTL ] to set the program counter to a desired location before you enter the learn mode. For example, if you want to edit step 0025 of program memory, first press [ INV ] [ 2nd ] [ GTL ] 0025 to set the program counter to step 0025. Then press [ LEARN ] { PC } to enter the learn mode.

The Subroutine Return Stack

Subroutine return addresses are stored in a system memory area called the subroutine return stack. Each time an SBL or SBR instruction is executed, a return address is added to the stack. Each time a RTN (return) instruction is executed, the return address that was stored last is removed from the stack.

The calculator can store up to eight return addresses. If a program exceeds this limit, the error message SBR STACK FULL is displayed and the program stops. Any error that stops program execution clears the subroutine return stack.

Subroutine Label

[ 2nd ] [ SBL ] aa

As a program instruction, [ 2nd ] [ SBL ] stores the address of the next instruction as a return address and then transfers execution to the instruction following label aa in the current program or file. As a keyboard command, [ 2nd ] [ SBL ] starts execution at the labeled segment in program memory, but does not store a return address. Using [ 2nd ] [ SBL ] as a keyboard command clears the subroutine return stack.

Subroutine

[ INV ] [ 2nd ] [ SBL ] nnnn

As a program instruction, [ INV ] [ 2nd ] [ SBL ] stores the address of the next instruction as a return address and then transfers execution to the program segment beginning at address nnnn in the current program or file. As a keyboard command, [ INV ] [ 2nd ] [ SBL ] transfers execution to address nnnn in program memory, but does not save a return address. Using [ INV ] [ 2nd ] [ SBL ] as a keyboard command clears the subroutine return stack.

The instruction mnemonic for [ INV ] [ 2nd ] [ SBL ] is SBR.

Return

[ 2nd ] [ RTN ]

Transfers program execution to the return address stored most recently. If no return addresses are stored in the subroutine stack, a return instruction stops program execution just as a HLT (halt) instruction does.

As explained in the "File Operations" chapter of this guide, you can execute an entire program as a subroutine after the program is saved as a file. If you intend to execute a program as a subroutine, use a RTN instruction at the end of the program instead of a HLT instruction.

Define Function Key

[ 2nd ] DFN ] Fx:aaa@aa

Defines function key Fx, where Fx represents one of the five function keys, aaa represents the three-character message to be displayed above the function key, and aa represents the label to which execution transfers when you press Fx. The calculator supplies the ":" and "@" characters as the instruction is entered into program memory.

The function keys are activated after program execution is stopped and remain in effect as long as the definitions are visible in the display. If subsequent system-menu operations replace the definitions, you can restore the most recently defined function keys by pressing [ OLD ].

[ 2nd ] DFN is ignored as a keyboard command.

Clear All Function Keys

[ 2nd ] [ DFN ] [ CLEAR ]

Clears the definitions of all the function keys and erases the function labels from the display. After function definitions have been cleared by this sequence, they cannot be recalled by [ OLD ]. [ 2nd ] [ DFN ] [ CLEAR ] is ignored as a keyboard command.

The instruction mnemonic for [ 2nd ] [ DFN ] [ CLEAR ] is DFN CLR.

Clear a Function Key

[ 2nd ] [ DFN ] Fx [ CLEAR ]

Clears the definition of function key Fx and erases the function label from the display. Once a function definition has been cleared by this sequence, it cannot be recalled by [ OLD ]. [ 2nd ] [ DFN ] Fx [ CLEAR ] is ignored as a keyboard command.

The instruction mnemonic for [ 2nd ] [ DFN ] Fx [ CLEAR ] is DFN Fx CLR.

Old Menu

[ OLD ]

Restores the most recently defined user menu and user alpha message. [ OLD ] does not restore user-defined menus that have been cleared by DFN CLR or DFN Fx CLR.

[ OLD ] does not restore system menus.

Assemble Program

[ 2nd ] [ ASM ]

Changes all label addressing used by the program in program memory into direct numeric addressing. Assembling converts GTL instructions to GTO, SBL instructions to SBR, and DFN instructions to DFA. You cannot enter the DFA (define function absolute) instruction from the keyboard.

Disassemble Program

[ INV ] [ 2nd ] [ ASM ]

Disassembles a previously assembled program. This restores label addresses and converts GTO instructions to GTL, SBR instructions to SBL, and DFA instructions to DFN. Instructions that were stored originally with numeric addressing are not converted to label addressing.


Back

Constant Memory™ is a trademark of Texas Instruments Incorporated.