126 Chapter 3: Application Development Process
TI-83 Plus Developer Guide Third Release May 28, 2002
Branch Table Placement
Application execution begins at the address immediately following the header. The
branch table is not part of the header, but must be placed immediately after the header.
To resolve this conflict, a jump instruction to the start of the application needs to be
placed between the end of the header and the start of the table.
Also, the first entry in the branch table must be located at an address which is a multiple
of three bytes from the beginning of the page. You may need to add padding bytes
before the branch table to ensure this.
Branch Table Equate File
Whenever a branch table exists, an include file must also be generated that contains
equates for the branch table entries. Each equate in the file is the name of the routine in
the branch table with an underscore character prefixed to it. The associated value is the
byte offset where the routine’s table entry begins.
For example, the routine showGoodByeP2 exists on the second application page but
must be called from the first application page, so it needs an entry in the branch table.
The branch table entry for this routine happened to be located at a position 41 times
three-bytes from the start of the first application page.
; Byte offset 41 * 3
DW showGoodByeP2 ; Address
DB 1 ; Second app page
So in the include file the following equate is created.
_showGoodByeP2 equ 41*3
This include file must be included in any source code that calls or jumps to a routine on
another page.
Making Off-Page Calls and Jumps
When code calls or jumps to a routine on an application page different from the point of
the call, this is known as an off-page call or jump. The B_CALL and B_JUMP macros
must be used when making off-page calls and jumps. For example, when the routine
showHelloP2, which is on the second page, is called from the first page, the call must be
made as follow:
B_CALL showHelloP2
A call of the form
CALL showHelloP2
will not work at all.
When an on-page call, a call to a routine that exists on the same application page as the
point of the call, is made, the normal call opcode should be used. B_CALL and B_JUMP
should not be used in this case.