/* Recommended that you maintain the same order as above */
APP_EXT_ENTRY const extEntries[] =
{
{<extensionroutine1>, APP_EXT_FUNCTION},
{<extensionroutine2>, APP_EXT_FUNCTION}
};
FRAME(tibasicextFrame, OO_SYSTEM_FRAME, 0, OO_APP_FLAGS, FRAME_LENGTH)
ATTR(OO_APP_FLAGS, APP_NONE)
ATTR(OO_APP_NAME, "My Flash App")
ATTR(OO_APP_TOK_NAME, "MyApp")
ATTR(OO_APP_EXT_COUNT, NUMBER_OF_EXTENSIONS) /* export extension
functions */
ATTR(OO_APP_EXTENSIONS, extensions) /* address of
extensions table */
ATTR(OO_APP_EXT_ENTRIES, extEntries) /* address of ext entries
table */
ATTR(OO_APPSTRING+<EXTENSION1>_OFFSET, "MyExt1") /* TIOS function names
*/
ATTR(OO_APPSTRING+<EXTENSION2>_OFFSET, "MyExt2") /* TIOS function names
*/
/* Catalog
description follows: */
ATTR(OO_APPSTRING+HELP_OFFSET+<EXTENSION1>_OFFSET, "Help for MyApp.MyExt1")
ATTR(OO_APPSTRING+HELP_OFFSET+<EXTENSION2>_OFFSET, "Help for MyApp.MyExt2")
ENDFRAME
/* Frame pointer required as the first static value in app */
pFrame TIBasicExtensionFrame = (pFrame)&tibasicextFrame;
//Some defines that might be useful if you are used to TIGCC
#define GetArgType(p) (*(unsigned char*)(p))
#define malloc(sz) HeapDeref(HeapAllocHigh(sz))
#define calloc(NoOfItems,SizeOfItems) malloc(NoOfItems*SizeOfItems)
#define HeapFreePtr(vr) HeapFree(HeapPtrToHandle(vr))
//This is how you use ROM calls directly.
//The number (291) after "tiamsapi_" is the ROM call number in decimal.
//For some ROM calls that don't have corresponding functions in the SDK,
//you can find the ROM call number (in hex) and the parameters from the
//TIGCC documentation.
void tiamsapi_291(BN*, const BN*, const BN*, const BN*);
#define BN_powerMod tiamsapi_291
void <extensionroutine1>(void)
{
void subroutine1(EStackIndex, float, float*, float);
EStackIndex argptr;
Access_AMS_Global_Variables;
argptr = top_estack;
...
push_Float(res); //Can push other types too; this is just an example.
return;
}
void subroutine1(EStackIndex ptr, float x, float* y, float z)
{
float subroutine2(float);
...
return; //Returns result through pointer
}
float subroutine2(float x)
{
...
return result;
10 - 3