EasyManua.ls Logo

Texas Instruments TI-89 - Interfacing with TI-BASIC

Texas Instruments TI-89
1398 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
70
Chapter 8: Integrating a Flash Application
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
8.4. Interfacing with TI-BASIC
An app can directly call many of the TI
-
BASIC commands. These commands
begin with “cmd_” and are included in
Appendix A
. The C callable TI
-
BASIC
functions or operators usually begin with “push_”. Examples include clearing the
program I/O screen with the
cmd_clrio
routine and writing to the program I/O
screen using the
cmd_disp
routine. An example function is
push_getfold
which
is the TI
-
BASIC getFold function. TI
-
BASIC uses the expression stack (estack) to
pass and return parameters. See chapter
15. Expressions and the Expression
Stack
for a description of this stack and its contents. For a description of the data
types used by TI
-
BASIC see chapter
14. Data Types
.
An app can also embed entire TI
-
BASIC programs or data. In fact, an app can
consist of essentially nothing but TI
-
BASIC programs and data as shown in the
following example. This example loads a TI
-
BASIC program using its StoProg
function (which can store any TI
-
BASIC data item). The tokenized version of the
program is in the prog1Data array. This array came from the TI
-
GRAPH LINK™
file containing the program. The program is run by using RunProg. The example
program merely displays “Test” to the Program I/O screen. After the program
runs, it is deleted. The TIBASIC_run function handles all errors including the
´
key (to break the app). In this way, the user of the app does not even know a
TI
-
BASIC program is running.
/* BASIC -> APP Wrapper */
#include "product.h"
#include "tiams.h"
static void AP_app(pFrame self, PEvent e);
#define ProgEnd(Prog) (Prog+(sizeof(Prog) - 1))
FRAME(appObj, OO_SYSTEM_FRAME, 0, OO_APP_FLAGS, 3)
ATTR(OO_APP_FLAGS, APP_INTERACTIVE)
ATTR(OO_APP_NAME, "prog1" )
ATTR(OO_APP_PROCESS_EVENT, &AP_app)
ENDFRAME
pFrame pAppObj = (pFrame)&appObj;
runningBASIC = FALSE;
const BYTE prog1Data[]={0X00,0X1D,0XE9,0X12,0XE4,0X00,0XE8,0XE5,0X51,
0XE4,0X02,0XE8,0XE5,0X00,0X54,0X65,0X73,0X74,0X00,0X2D,0X7A,0XE4,
0X02,0XE8,0X19,0XE4,0XE5,0X00,0X00,0X00,0XDC};
/* Run a BASIC program */
HANDLE TIBASIC_run(HANDLE hProgram, SINT *errNo)
{
Access_AMS_Global_Variables;
EStackIndex savetop = top_estack;
USHORT errOffset;
HANDLE hTokenized = H_NULL;
HANDLE hResult = H_NULL;

Table of Contents

Other manuals for Texas Instruments TI-89

Related product manuals