Optimizing Code Space - Texas Instruments TI-89 Developer's Manual

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Chapter 8: Integrating a Flash Application
F-Lines can also be used to convert long calls or jumps to relative jumps or calls
which reduces the app's relocation table and hence the app's size. See section
7.1 File Format for a description of the relocation table.
8.6.

Optimizing Code Space

One of the optimizations involves reducing the apps relocation table. All
references to an app's global variables made by an app require a relocation entry
to be stored with the app. If there are multiple references to a particular global
variable in an app, the global references can be replaced with local pointers as
shown in the example below.
static WINDOW appW;
static WIN_RECT appWRect;
void AP_EventHandler(pFrame self, PEvent e) {
WINDOW *winPtr = &appW;
switch (e->command) {
case CM_START:
case CM_ACTIVATE:
.
.
.
}
}
In the preceding example, since there were several references to the global
variable appW the pointer winPtr was initialized to the address of appW at the
entry point to the AP_EventHandler routine and used instead of &appW. Since
there was only one additional reference to appWRect an additional pointer to
access that global was not created.
TI-89 / TI-92 Plus Developer Guide
appWRect = *(e->info.startInfo.startRect);
if (WinOpen( winPtr, &appWRect, WF_TTY
WinClr( winPtr );
else
EV_quit();
break;
EV_defaultHandler(e);
WinBeginPaint( winPtr );
WinActivate( winPtr );
WinStr( winPtr, "Just activated\n" );
break;
Not for Distribution
| WF_DUP_SCR))
Beta Version January 26, 2001
75

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents