Difference between revisions of "84PCE:OS:C Include File"

From WikiTI
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:84PCE:OS_Information]]
 
[[Category:84PCE:OS_Information]]
= C Function Prototypes=
+
= C Definitions =
 
<pre>// Parts from Matt "MateoConLechuga" Waltz and Jacob "jacobly" Young, in addtion to
 
<pre>// Parts from Matt "MateoConLechuga" Waltz and Jacob "jacobly" Young, in addtion to
 
// contributors of http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File
 
// contributors of http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File
// Latest as of June 2016
+
// Latest as of October 2016
  
 
#ifndef TICE_H
 
#ifndef TICE_H
Line 12: Line 12:
 
#include <stddef.h>
 
#include <stddef.h>
  
#define randInt(min, max)      ((unsigned)rand() % ((max) - (min) + 1) + (min))
 
  
/* Defines for MMIO memory areas */
+
/************* HARDWARE AND CUSTOM ROUTINES *************/
  
/* RTC defines */
 
/* There’s a whole slew of bootcode RTC functions, but a lot of them are kind of pointless when you could just use these defines from MMIO */
 
#define rtc_GetSeconds()        (*((uint8_t*)0xF30000))
 
#define rtc_GetMinutes()        (*((uint8_t*)0xF30004))
 
#define rtc_GetHours()          (*((uint8_t*)0xF30008))
 
#define rtc_GetDays()          (*((uint16_t*)0xF3000C))
 
#define rtc_GetControl()        (*((uint8_t*)0xF30020))
 
#define rtc_SetControl(c)      ((*((uint8_t*)0xF30020)) = (uint8_t)(c))
 
#define rtc_LoadSetTime()      ((*((uint8_t*)0xF30020)) = (*((uint8_t*)0xF30020))|64)
 
#define rtc_SetSeconds(s)      ((*((uint8_t*)0xF30024)) = (uint8_t)(s))
 
#define rtc_SetMinutes(m)      ((*((uint8_t*)0xF30028)) = (uint8_t)(m))
 
#define rtc_SetHours(h)        ((*((uint8_t*)0xF3002C)) = (uint8_t)(h))
 
#define rtc_SetDays(d)          ((*((uint16_t*)0xF30030)) = (uint16_t)(d))
 
#define rtc_Time()              (*(volatile uint32_t*)0xF30044)
 
  
/**
+
/* Creates a random integer value */
* Resets the RTC back to its original values
+
#define randInt(min, max)  (unsigned)rand() % ((max) - (min) + 1) + (min))
* If enable is true, the RTC will be enabled during this function
+
*/
+
void boot_RTCInitialize(bool enable);
+
  
/**
+
/* RTC define -- useful for srand() */
* Returns a pointer to the system stats
+
#define rtc_Time()          (*(volatile uint32_t*)0xF30044)
*/
+
void *os_GetSystemStats(void);
+
  
/**
+
/* RTC definitions */
  * Sets up the defualt error handlers if an OS routine encounters an error when running
+
#define RTC_UNFREEZE        (1<<7)
*/
+
#define RTC_FREEZE          (0<<7)
void os_PushErrorHandler(void *routine);
+
#define RTC_LOAD            (1<<6)
void os_PopErrorHandler(void);
+
#define RTC_ENABLE          (1<<0)|RTC_UNFREEZE
 +
#define RTC_DISABLE        (0<<0)
 +
 
 +
/* RTC registers */
 +
#define rtc_Seconds        (*(volatile uint8_t*)0xF30000)
 +
#define rtc_Minutes        (*(volatile uint8_t*)0xF30004)
 +
#define rtc_Hours          (*(volatile uint8_t*)0xF30008)
 +
#define rtc_Days            (*(volatile uint16_t*)0xF3000C)
 +
#define rtc_AlarmSeconds    (*(uint8_t*)0xF30010)
 +
#define rtc_AlarmMinutes    (*(uint8_t*)0xF30014)
 +
#define rtc_AlarmHours      (*(uint8_t*)0xF30018)
 +
#define rtc_Control        (*(uint8_t*)0xF30020)
 +
#define rtc_LoadSeconds    (*(uint8_t*)0xF30024)
 +
#define rtc_LoadMinutes    (*(uint8_t*)0xF30028)
 +
#define rtc_LoadHours      (*(uint8_t*)0xF3002C)
 +
#define rtc_LoadDays        (*(uint16_t*)0xF30030)
 +
#define rtc_IntStatus      (*(volatile uint8_t*)0xF30034)
 +
#define rtc_IntAcknowledge (*(volatile uint8_t*)0xF30034)
 +
#define rtc_IsBusy()        (rtc_Control & RTC_LOAD)
 +
 
 +
/* RTC interrupt masks */
 +
#define RTC_ALARM_INT_SOURCE    (1<<5)
 +
#define RTC_DAY_INT_SOURCE      (1<<4)
 +
#define RTC_HR_INT_SOURCE      (1<<3)
 +
#define RTC_MIN_INT_SOURCE      (1<<2)
 +
#define RTC_SEC_INT_SOURCE      (1<<1)
 +
 
 +
/* RTC interrupt statuses */
 +
#define RTC_LOAD_INT            (1<<5)
 +
#define RTC_ALARM_INT          (1<<4)
 +
#define RTC_DAY_INT            (1<<3)
 +
#define RTC_HR_INT              (1<<2)
 +
#define RTC_MIN_INT            (1<<1)
 +
#define RTC_SEC_INT            (1<<0)
 +
#define RTC_INT_MASK            (RTC_SEC_INT | RTC_MIN_INT | RTC_HR_INT | RTC_DAY_INT | RTC_ALARM_INT | RTC_LOAD_INT)
 +
 
 +
/* Whole bunch of useful timer functions */
 +
#define TIMER1_ENABLE 1 << 0 // Enables Timer 1
 +
#define TIMER1_DISABLE 0 << 0 // Disables Timer 1
 +
#define TIMER1_32K 1 << 1 // Use the 32K clock for timer 1
 +
#define TIMER1_CPU 0 << 1 // Use the CPU clock rate for timer 1
 +
#define TIMER1_0INT 1 << 2 // Enable an interrupt when 0 is reached for the timer 1
 +
#define TIMER1_NOINT 0 << 2 // Disable interrupts for the timer 1
 +
#define TIMER1_UP 1 << 9 // Timer 1 counts up
 +
#define TIMER1_DOWN 0 << 9 // Timer 1 counts down
 +
 
 +
#define TIMER2_ENABLE 1 << 3 // Enables Timer 2
 +
#define TIMER2_DISABLE 0 << 3 // Enables Timer 2
 +
#define TIMER2_32K 1 << 4 // Use the 32K clock for timer 2
 +
#define TIMER2_CPU 0 << 4 // Use the CPU clock rate for timer 2
 +
#define TIMER2_0INT 1 << 5 // Enable an interrupt when 0 is reached for the timer 2
 +
#define TIMER2_NOINT 0 << 5 // Disable interrupts for the timer 2
 +
#define TIMER2_UP 1 << 10 // Timer 2 counts up
 +
#define TIMER2_DOWN 0 << 10 // Timer 2 counts down
 +
 
 +
/* These defines can be used to check the status of the timer */
 +
#define TIMER1_MATCH1 1 << 0 // Timer 1 hit the first match value
 +
#define TIMER1_MATCH2 1 << 1 // Timer 1 hit the second match value
 +
#define TIMER1_RELOADED 1 << 2 // Timer 1 was reloaded (Needs to have TIMER1_0INT enabled)
 +
 
 +
#define TIMER2_MATCH1 1 << 3 // Timer 2 hit the first match value
 +
#define TIMER2_MATCH2 1 << 4 // Timer 2 hit the second match value
 +
#define TIMER2_RELOADED 1 << 5 // Timer 2 was reloaded (Needs to have TIMER2_0INT enabled)
 +
 
 +
/* Timer registers */
 +
#define timer_1_Counter (*(volatile uint32_t *)0xF20000)
 +
#define timer_2_Counter (*(volatile uint32_t *)0xF20010)
 +
#define timer_1_ReloadValue (*(uint32_t *)0xF20004)
 +
#define timer_2_ReloadValue (*(uint32_t *)0xF20014)
 +
#define timer_1_MatchValue_1 (*(uint32_t *)0xF20008)
 +
#define timer_1_MatchValue_2 (*(uint32_t *)0xF2000C)
 +
#define timer_2_MatchValue_1 (*(uint32_t *)0xF20018)
 +
#define timer_2_MatchValue_2 (*(uint32_t *)0xF2001C)
 +
#define timer_Control (*(uint32_t *)0xF20030)
 +
#define timer_EnableInt (*(uint16_t *)0xF20038)
 +
#define timer_IntStatus (*(volatile uint16_t *)0xF20034)
 +
#define timer_IntAcknowledge (*(volatile uint16_t *)0xF20034)
  
 
/* LCD defines */
 
/* LCD defines */
#define lcd_GetBacklightLevel()  (*((uint8_t*)0xF60024))
+
#define lcd_BacklightLevel      (*(uint8_t*)0xF60024)
#define lcd_SetBacklightLevel(b) ((*((uint8_t*)0xF60024))) = (uint8_t)(b);
+
  
/**
+
/* OS varaible type definitions */
* OS varaible type definitions
+
*/
+
 
typedef struct { int8_t sign, exp; uint8_t mant[7]; } real_t;
 
typedef struct { int8_t sign, exp; uint8_t mant[7]; } real_t;
 
typedef struct { real_t real, imag; } cplx_t;
 
typedef struct { real_t real, imag; } cplx_t;
typedef struct { uint16_t dim; real_t *items; } list_t;
+
typedef struct { uint16_t dim; real_t items[1]; } list_t;
typedef struct { uint16_t dim; cplx_t *items; } cplx_list_t;
+
typedef struct { uint16_t dim; cplx_t items[1]; } cplx_list_t;
typedef struct { uint8_t cols, rows; real_t *items; } matrix_t;
+
typedef struct { uint8_t cols, rows; real_t items[1]; } matrix_t;
typedef struct { uint16_t size; uint8_t *data; } var_t;
+
typedef struct { uint16_t len; char data[1]; } string_t;
 +
typedef struct { uint16_t len; char data[1]; } equ_t;
 +
typedef struct { uint16_t size; uint8_t data[1]; } var_t;
  
/**
+
#define matrix_element(matrix, row, col) ((matrix)->items[(row)+(col)*(matrix)->rows])
* Cleans up everything and gets ready to enter back to the OS
+
#define NEG_SIGN_MASK    0x80
* when you are ready to exit your program
+
#define POS_SIGN_MASK    0x00
*/
+
#define CPLX_SIGN_MASK  0x0C
 +
 
 +
/* Cleans up everything and gets ready to enter back to the OS when you are ready to exit your program */
 
void prgm_CleanUp(void);
 
void prgm_CleanUp(void);
 
/* This is here because Mateo can't spell */
 
 
#define pgrm_CleanUp prgm_CleanUp
 
#define pgrm_CleanUp prgm_CleanUp
 +
 +
/* A faster implementation of memset */
 +
void *memset_fast(void *ptr,int value,size_t num);
 +
 +
 +
/************* TI OS SPECIFIC ROUTINES AND IMPLEMENTATIONS *************/
 +
  
 
/**
 
/**
  * A faster implementation of memset
+
  * Resets the RTC back to its original values
 +
* If enable is true, the RTC will be enabled during this function
 
  */
 
  */
void *memset_fast(void *ptr,int value,size_t num);
+
void boot_RTCInitialize(bool enable);
  
 
/**
 
/**
Line 100: Line 163:
 
  */
 
  */
 
bool boot_CheckOnPressed(void);
 
bool boot_CheckOnPressed(void);
 +
 +
/**
 +
* Basically a reimplemented form of printf that prints to some debugging device
 +
*/
 +
void boot_DebugPrintf(const char *string);
  
 
/**
 
/**
  * Returns extended keys as 16-bits
+
  * Turns off the calculator (probably not a good idea to use)
 
  */
 
  */
int os_GetKey(void);
+
void boot_TurnOff(void);
  
 
/**
 
/**
  * Performs an OS call to get the keypad scan code
+
  * Inserts a new line at the current cursor posistion on the homescreen
* Values returned are listed below
+
 
  */
 
  */
int os_GetCSC(void);
+
void boot_NewLine(void);
typedef uint8_t sk_key_t;
+
 
#define sk_Down      0x01
+
/**
#define sk_Left      0x02
+
* Prints the boot version at a really silly place on the homescreen
#define sk_Right      0x03
+
*/
#define sk_Up        0x04
+
void boot_PrintBootVersion(void);
#define sk_Enter      0x09
+
 
#define sk_2nd        0x36
+
/**
#define sk_Clear      0x0F
+
* Returns the current battery status
#define sk_Alpha      0x30
+
*/
#define sk_Add        0x0A
+
uint8_t boot_GetBatteryStatus(void);
#define sk_Sub        0x0B
+
 
#define sk_Mul        0x0C
+
/**
#define sk_Div        0x0D
+
* Waits for 10 ms
#define sk_Graph      0x31
+
*/
#define sk_Trace      0x32
+
void boot_WaitShort(void);
#define sk_Zoom      0x33
+
 
#define sk_Window    0x34
+
/**
#define sk_Yequ      0x35
+
* Set the time of the calculator
#define sk_Mode      0x37
+
*/
#define sk_Del        0x38
+
void boot_SetTime(uint8_t seconds, uint8_t minutes, uint8_t hours);
#define sk_Store      0x2A
+
#define sk_Ln        0x2B
+
#define sk_Log        0x2C
+
#define sk_Square    0x2D
+
#define sk_Recip      0x2E
+
#define sk_Math      0x2F
+
#define sk_0          0x21
+
#define sk_1          0x22
+
#define sk_4          0x23
+
#define sk_7          0x24
+
#define sk_2          0x1A
+
#define sk_5          0x1B
+
#define sk_8          0x1C
+
#define sk_3          0x12
+
#define sk_6          0x13
+
#define sk_9          0x14
+
#define sk_Comma      0x25
+
#define sk_Sin        0x26
+
#define sk_Apps      0x27
+
#define sk_GraphVar  0x28
+
#define sk_DecPnt    0x19
+
#define sk_LParen    0x1D
+
#define sk_Cos        0x1E
+
#define sk_Pgrm      0x1F
+
#define sk_Stat      0x20
+
#define sk_Chs        0x10
+
#define sk_RParen    0x15
+
#define sk_Tan        0x16
+
#define sk_Vars      0x17
+
#define sk_Power      0x0E
+
  
 
/**
 
/**
Line 176: Line 213:
 
  */
 
  */
 
void os_SetDrawFGColor(int color);
 
void os_SetDrawFGColor(int color);
int os_GetDrawFGColor(void);
+
uint24_t os_GetDrawFGColor(void);
  
 
/**
 
/**
Line 182: Line 219:
 
  * os_GetDrawBGColor is only useable in OS 5.2 and above; use at your own risk
 
  * os_GetDrawBGColor is only useable in OS 5.2 and above; use at your own risk
 
  */
 
  */
void os_SetDrawBGColor(int color);
+
void os_SetDrawBGColor(uint24_t color);
void os_GetDrawBGColor(int color);
+
uint24_t os_GetDrawBGColor(void);
  
 
/**
 
/**
Line 189: Line 226:
 
  */
 
  */
 
void os_SetCursorPos(uint8_t curRow, uint8_t curCol);
 
void os_SetCursorPos(uint8_t curRow, uint8_t curCol);
void os_GetCursorPos(unsigned int *curRow, unsigned int *curCol);
+
void os_GetCursorPos(uint8_t **curRow, uint8_t **curCol);
  
 
/**
 
/**
Line 197: Line 234:
 
  */
 
  */
 
void os_FontSelect(char id);
 
void os_FontSelect(char id);
int os_FontGetID(void);
+
uint24_t os_FontGetID(void);
  
 
/**
 
/**
Line 203: Line 240:
 
  * Second function is used to get the height of the characters
 
  * Second function is used to get the height of the characters
 
  */
 
  */
int os_FontGetWidth(const char *string);
+
uint24_t os_FontGetWidth(const char *string);
int os_FontGetHeight(void);
+
uint24_t os_FontGetHeight(void);
  
 
/**
 
/**
Line 210: Line 247:
 
  * Returns the end column
 
  * Returns the end column
 
  */
 
  */
int os_FontDrawText(const char *string, uint16_t col, uint8_t row);
+
uint24_t os_FontDrawText(const char *string, uint16_t col, uint8_t row);
int os_FontDrawTransText(const char *string, uint16_t col, uint8_t row);
+
uint24_t os_FontDrawTransText(const char *string, uint16_t col, uint8_t row);
  
 
/**
 
/**
Line 217: Line 254:
 
  * Returns 1 if string fits on screen, 0 otherwise
 
  * Returns 1 if string fits on screen, 0 otherwise
 
  */
 
  */
int os_PutStrFull(const char *string);
+
uint24_t os_PutStrFull(const char *string);
  
 
/**
 
/**
Line 223: Line 260:
 
  * Returns 1 if string fits on line, 0 otherwise
 
  * Returns 1 if string fits on line, 0 otherwise
 
  */
 
  */
int os_PutStrLine(const char *string);
+
uint24_t os_PutStrLine(const char *string);
  
 
/**
 
/**
Line 240: Line 277:
 
  */
 
  */
 
void os_ThrowError(uint8_t error);
 
void os_ThrowError(uint8_t error);
 +
 +
/**
 +
* Returns a pointer to the system stats
 +
*/
 +
void *os_GetSystemStats(void);
 +
 +
/**
 +
* Sets up the defualt error handlers if an OS routine encounters an error when running
 +
*/
 +
void os_PushErrorHandler(void *routine);
 +
void os_PopErrorHandler(void);
  
 
/**
 
/**
Line 270: Line 318:
  
 
/**
 
/**
  * Copies a real_t type to another location
+
  * Copies a real_t
* Returns dest
+
 
  */
 
  */
real_t *os_RealCopy(real_t *dest, const real_t *src);
+
real_t os_RealCopy(const real_t *src);
  
 
/**
 
/**
  * Urnary operations used to interact with the OS math functions
+
  * Unary operations used to interact with the OS math functions
* All return result
+
 
  */
 
  */
real_t *os_RealAcosRad(real_t *result, const real_t *arg);
+
real_t os_RealAcosRad(const real_t *arg);
real_t *os_RealAsinRad(real_t *result, const real_t *arg);
+
real_t os_RealAsinRad(const real_t *arg);
real_t *os_RealAtanRad(real_t *result, const real_t *arg);
+
real_t os_RealAtanRad(const real_t *arg);
real_t *os_RealCosRad(real_t *result, const real_t *arg);
+
real_t os_RealCosRad(const real_t *arg);
real_t *os_RealRadToDeg(real_t *result, const real_t *arg);
+
real_t os_RealRadToDeg(const real_t *arg);
real_t *os_RealExp(real_t *result, const real_t *arg);
+
real_t os_RealExp(const real_t *arg);
real_t *os_RealFloor(real_t *result, const real_t *arg);
+
real_t os_RealFloor(const real_t *arg);
real_t *os_RealFrac(real_t *result, const real_t *arg);
+
real_t os_RealFrac(const real_t *arg);
real_t *os_RealRoundInt(real_t *result, const real_t *arg);
+
real_t os_RealRoundInt(const real_t *arg);
real_t *os_RealLog(real_t *result, const real_t *arg);
+
real_t os_RealLog(const real_t *arg);
real_t *os_RealNeg(real_t *result, const real_t *arg);
+
real_t os_RealNeg(const real_t *arg);
real_t *os_RealDegToRad(real_t *result, const real_t *arg);
+
real_t os_RealDegToRad(const real_t *arg);
real_t *os_RealInv(real_t *result, const real_t *arg);
+
real_t os_RealInv(const real_t *arg);
real_t *os_RealSinRad(real_t *result, const real_t *arg);
+
real_t os_RealSinRad(const real_t *arg);
real_t *os_RealSqrt(real_t *result, const real_t *arg);
+
real_t os_RealSqrt(const real_t *arg);
real_t *os_RealTanRad(real_t *result, const real_t *arg);
+
real_t os_RealTanRad(const real_t *arg);
real_t *os_RealInt(real_t *result, const real_t *arg);
+
real_t os_RealInt(const real_t *arg);
cplx_t *os_CplxSquare(cplx_t *result, const cplx_t *arg);
+
cplx_t os_CplxSquare(const cplx_t *arg);
  
 
/**
 
/**
 
  * Binary operations used to interact with the OS math functions
 
  * Binary operations used to interact with the OS math functions
* All return result
 
 
  */
 
  */
real_t *os_RealAdd(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealAdd(const real_t *arg1, const real_t *arg2);
real_t *os_RealDiv(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealDiv(const real_t *arg1, const real_t *arg2);
real_t *os_RealGcd(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealGcd(const real_t *arg1, const real_t *arg2);
real_t *os_RealLcm(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealLcm(const real_t *arg1, const real_t *arg2);
real_t *os_RealMax(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealMax(const real_t *arg1, const real_t *arg2);
real_t *os_RealMin(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealMin(const real_t *arg1, const real_t *arg2);
real_t *os_RealMul(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealMul(const real_t *arg1, const real_t *arg2);
real_t *os_RealNcr(real_t *result, const real_t *total, const real_t *num);
+
real_t os_RealNcr(const real_t *total, const real_t *num);
real_t *os_RealNpr(real_t *result, const real_t *total, const real_t *num);
+
real_t os_RealNpr(const real_t *total, const real_t *num);
real_t *os_RealPow(real_t *result, const real_t *base, const real_t *exp);
+
real_t os_RealPow(const real_t *base, const real_t *exp);
real_t *os_RealRandInt(real_t *result, const real_t *min, const real_t *max);
+
real_t os_RealRandInt(const real_t *min, const real_t *max);
real_t *os_RealMod(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealMod(const real_t *arg1, const real_t *arg2);
real_t *os_RealSub(real_t *result, const real_t *arg1, const real_t *arg2);
+
real_t os_RealSub(const real_t *arg1, const real_t *arg2);
 
/**
 
/**
 
  * digits must be in the range 0 - 9
 
  * digits must be in the range 0 - 9
 
  */
 
  */
real_t *os_RealRound(real_t *result, const real_t *arg, char digits);
+
real_t os_RealRound(const real_t *arg, char digits);
  
 
/**
 
/**
Line 324: Line 369:
 
  */
 
  */
 
int os_RealCompare(const real_t *arg1, const real_t *arg2);
 
int os_RealCompare(const real_t *arg1, const real_t *arg2);
 +
 +
/**
 +
* Conversion routines for ti-floats.
 +
* All saturate on overflow.
 +
*/
 +
int24_t os_RealToInt24(const real_t *arg);
 +
real_t os_Int24ToReal(int24_t arg);
 +
float os_RealToFloat(const real_t *arg);
 +
real_t os_FloatToReal(float arg);
  
 
/** os_RealToStr:
 
/** os_RealToStr:
Line 353: Line 407:
 
   *  returns result
 
   *  returns result
 
   */
 
   */
real_t *os_StrToReal(real_t *result, const char *string, char **end);
+
real_t os_StrToReal(const char *string, char **end);
 
+
/**
+
* Basically a reimplemented form of printf that prints to some debugging device
+
*/
+
void boot_DebugPrintf(const char *string);
+
  
 
/**
 
/**
  * Turns off the calculator (probably not a good idea to use)
+
  * High 8 is unsigned offset, low 8 is bits to test
 +
* os_TestFlagBits will return a 0 or 1
 
  */
 
  */
void boot_TurnOff(void);
+
int os_TestFlagBits(uint16_t offset_pattern);
 +
void os_SetFlagBits(int16_t offset_pattern);
 +
void os_ResetFlagBits(int16_t offset_pattern);
  
 
/**
 
/**
  * Inserts a new line at the current cursor posistion on the homescreen
+
  * Returns extended key in high byte
 
  */
 
  */
void boot_NewLine(void);
+
uint16_t os_GetKey(void);
  
 
/**
 
/**
  * Prints the boot version at a really silly place on the homescreen
+
  * Performs an OS call to get the keypad scan code
 +
* Technically return type is uint24_t, but that is not useful as the high byte is 0
 +
* Values returned are listed below
 
  */
 
  */
void boot_PrintBootVersion(void);
+
uint8_t os_GetCSC(void);
 +
typedef uint8_t sk_key_t;
  
 
/**
 
/**
  * Sets the calculator into 6MHz mode and 48MHz modes. Note that the ones
+
  * Things you shouldn't use unless you know what you are doing
* suffix with I perserve the interrupt vectors
+
 
  */
 
  */
 +
void os_ForceCmdNoChar(void);
 
void boot_Set6MHzMode(void);
 
void boot_Set6MHzMode(void);
 
void boot_Set48MHzMode(void);
 
void boot_Set48MHzMode(void);
Line 385: Line 440:
  
 
/**
 
/**
  * Returns the current battery status
+
  * Use this function to call assembly functions in the OS and Bootcode
 +
* i.e. _OS( asm_HomeUp );
 
  */
 
  */
uint8_t boot_GetBatteryStatus(void);
+
void _OS(void (*function)(void));
  
 
/**
 
/**
  * Waits for just a bit
+
  * Assembly functions ( Don't forget to call from _OS() )
* Someone should really look at this to see how long it actually is
+
 
  */
 
  */
void boot_WaitShort(void);
+
void asm_MoveUp(void);
 +
void asm_MoveDown(void);
 +
void asm_HomeUp(void);
 +
void asm_RunIndicOn(void);
 +
void asm_RunIndicOff(void);
 +
void asm_DisableAPD(void);
 +
void asm_EnableAPD(void);
 +
void asm_ArcChk(void);
  
 
/**
 
/**
  * Checks if the calculator is being powered via USB
+
  * OS RAM Location defines for direct modification
 
  */
 
  */
bool boot_USBPowered(void);
+
#define OS_BLUE_COLOR      10
 +
#define OS_RED_COLOR        11
 +
#define OS_BLACK_COLOR      12
 +
#define OS_MAGENTA_COLOR    13
 +
#define OS_GREEN_COLOR      14
 +
#define OS_ORANGE_COLOR    15
 +
#define OS_BROWN_COLOR      16
 +
#define OS_NAVY_COLOR      17
 +
#define OS_LTBLUE_COLOR    18
 +
#define OS_YELLOW_COLOR    19
 +
#define OS_WHITE_COLOR      20
 +
#define OS_LTGRAY_COLOR    21
 +
#define OS_MEDGRAY_COLOR    22
 +
#define OS_GRAY_COLOR      23
 +
#define OS_DARKGRAY_COLOR  24
  
/**
+
#define os_ramStart          ((uint8_t*)0xD00000)
  * Checks if there is not a USB plug of A type in the USB port
+
#define os_flags            ((uint8_t*)0xD00080)
  */
+
#define os_textFlags        (*(uint8_t*)0xD00080)
bool boot_NotPlugTypeA(void);
+
#define os_apdFlags          (*(uint8_t*)0xD00088)
 +
#define os_rclFlags          (*(uint8_t*)0xD0008E)
 +
   
 +
#define os_kbdScanCode      (*(uint8_t*)0xD00587)
 +
#define os_kbdLGSC          (*(uint8_t*)0xD00588)
 +
#define os_kbdPSC            (*(uint8_t*)0xD00589)
 +
#define os_kbdWUR            (*(uint8_t*)0xD0058A)
 +
#define os_kbdDebncCnt      (*(uint8_t*)0xD0058B)
 +
#define os_kbdKey     (*(uint8_t*)0xD0058C)
 +
#define os_kbdGetKy          (*(uint8_t*)0xD0058D)
 +
#define os_keyExtend        (*(uint8_t*)0xD0058E)
 +
#define os_brightness        (*(uint8_t*)0xD0058F)
 +
#define os_apdSubTimer      (*(uint8_t*)0xD00590)
 +
#define os_apdTimer          (*(uint8_t*)0xD00591)
 +
#define os_curRow            (*(uint8_t*)0xD00595)
 +
#define os_curCol            (*(uint8_t*)0xD00596)
 +
 
 +
#define os_OP1              ((uint8_t*)0xD005F8)
 +
#define os_OP2              ((uint8_t*)0xD00603)
 +
#define os_OP3              ((uint8_t*)0xD0060E)
 +
#define os_OP4              ((uint8_t*)0xD00619)
 +
#define os_OP5              ((uint8_t*)0xD00624)
 +
#define os_OP6              ((uint8_t*)0xD0062F)
 +
 
 +
#define os_progToEdit        ((char*)0xD0065B)
 +
#define os_nameBuff          ((char*)0xD00663)
 +
 
 +
#define os_promptRow        (*(uint8_t*)0xD00800)
 +
#define os_promptCol        (*(uint8_t*)0xD00801)
 +
#define os_promptIns        (*(uint8_t*)0xD00802)
 +
#define os_promptShift      (*(uint8_t*)0xD00803)
 +
#define os_promptRet        (*(uint8_t*)0xD00804)
 +
#define os_promptValid      (*(uint8_t*)0xD00807)
 +
 
 +
#define os_penCol            (*(uint24_t*)0xD008D2)
 +
#define os_penRow            (*(uint8_t*)0xD008D5)
 +
 
 +
#define os_asmPrgmSize      (*(uint16_t*)0xD0118C)
 +
 
 +
#define os_y1LineType        (*(uint8_t*)0xD024BF)
 +
#define os_y2LineType        (*(uint8_t*)0xD024C0)
 +
#define os_y3LineType        (*(uint8_t*)0xD024C1)
 +
#define os_y4LineType        (*(uint8_t*)0xD024C2)
 +
#define os_y5LineType        (*(uint8_t*)0xD024C3)
 +
#define os_y6LineType        (*(uint8_t*)0xD024C4)
 +
#define os_y7LineType        (*(uint8_t*)0xD024C5)
 +
#define os_y8LineType        (*(uint8_t*)0xD024C6)
 +
#define os_y9LineType        (*(uint8_t*)0xD024C7)
 +
#define os_y0LineType        (*(uint8_t*)0xD024C8)
 +
#define os_para1LineType    (*(uint8_t*)0xD024C9)
 +
#define os_para2LineType    (*(uint8_t*)0xD024CA)
 +
#define os_para3LineType    (*(uint8_t*)0xD024CB)
 +
#define os_para4LineType    (*(uint8_t*)0xD024CC)
 +
#define os_para5LineType    (*(uint8_t*)0xD024CD)
 +
#define os_para6LineType    (*(uint8_t*)0xD024CE)
 +
#define os_polar1LineType    (*(uint8_t*)0xD024CF)
 +
#define os_polar2LineType    (*(uint8_t*)0xD024D0)
 +
#define os_polar3LineType    (*(uint8_t*)0xD024D1)
 +
#define os_polar4LineType    (*(uint8_t*)0xD024D2)
 +
#define os_polar5LineType    (*(uint8_t*)0xD024D3)
 +
#define os_polar6LineType    (*(uint8_t*)0xD024D4)
 +
#define os_secULineType      (*(uint8_t*)0xD024D5)
 +
#define os_secVLineType      (*(uint8_t*)0xD024D6)
 +
#define os_secWLineType      (*(uint8_t*)0xD024D7)
 +
#define os_y1LineColor      (*(uint8_t*)0xD024D8)
 +
#define os_y2LineColor      (*(uint8_t*)0xD024D9)
 +
#define os_y3LineColor      (*(uint8_t*)0xD024DA)
 +
#define os_y4LineColor      (*(uint8_t*)0xD024DB)
 +
#define os_y5LineColor      (*(uint8_t*)0xD024DC)
 +
#define os_y6LineColor      (*(uint8_t*)0xD024DD)
 +
#define os_y7LineColor      (*(uint8_t*)0xD024DE)
 +
#define os_y8LineColor      (*(uint8_t*)0xD024DF)
 +
#define os_y9LineColor      (*(uint8_t*)0xD024E0)
 +
#define os_y0LineColor      (*(uint8_t*)0xD024E1)
 +
#define os_para1LineColor    (*(uint8_t*)0xD024E2)
 +
#define os_para2LineColor    (*(uint8_t*)0xD024E3)
 +
#define os_para3LineColor    (*(uint8_t*)0xD024E4)
 +
#define os_para4LineColor    (*(uint8_t*)0xD024E5)
 +
#define os_para5LineColor    (*(uint8_t*)0xD024E6)
 +
#define os_para6LineColor    (*(uint8_t*)0xD024E7)
 +
#define os_polar1LineColor  (*(uint8_t*)0xD024E8)
 +
#define os_polar2LineColor  (*(uint8_t*)0xD024E9)
 +
#define os_polar3LineColor  (*(uint8_t*)0xD024EA)
 +
#define os_polar4LineColor  (*(uint8_t*)0xD024EB)
 +
#define os_polar5LineColor  (*(uint8_t*)0xD024EC)
 +
#define os_polar6LineColor  (*(uint8_t*)0xD024ED)
 +
#define os_secULineColor    (*(uint8_t*)0xD024EE)
 +
#define os_secVLineColor    (*(uint8_t*)0xD024EF)
 +
#define os_secWLineColor    (*(uint8_t*)0xD024F0)
 +
 
 +
#define os_appErr1          ((char*)0xD025A9)
 +
#define os_appErr2          ((char*)0xD025B6)
 +
 
 +
#define os_cursorHookPtr    (*(uint24_t*)0xD025D5)
 +
#define os_libraryHookPtr    (*(uint24_t*)0xD025D8)
 +
#define os_rawKeyHookPtr    (*(uint24_t*)0xD025DB)
 +
#define os_getKeyHookPtr    (*(uint24_t*)0xD025DE)
 +
#define os_homescreenHookPtr (*(uint24_t*)0xD025E1)
 +
#define os_windowHookPtr    (*(uint24_t*)0xD025E4)
 +
#define os_graphHookPtr      (*(uint24_t*)0xD025E7)
 +
#define os_yEqualsHookPtr    (*(uint24_t*)0xD025EA)
 +
#define os_fontHookPtr      (*(uint24_t*)0xD025ED)
 +
#define os_regraphHookPtr    (*(uint24_t*)0xD025F0)
 +
#define os_graphicsHookPtr  (*(uint24_t*)0xD025F3)
 +
#define os_traceHookPtr      (*(uint24_t*)0xD025F6)
 +
#define os_parserHookPtr    (*(uint24_t*)0xD025F9)
 +
#define os_appChangeHookPtr (*(uint24_t*)0xD025FC)
 +
#define os_catalog1HookPtr  (*(uint24_t*)0xD025FF)
 +
#define os_helpHookPtr      (*(uint24_t*)0xD02602)
 +
#define os_cxRedispHookPtr  (*(uint24_t*)0xD02605)
 +
#define os_menuHookPtr      (*(uint24_t*)0xD02608)
 +
#define os_catalog2HookPtr  (*(uint24_t*)0xD0260B)
 +
#define os_tokenHookPtr      (*(uint24_t*)0xD0260E)
 +
#define os_localizeHookPtr  (*(uint24_t*)0xD02611)
 +
#define os_silentLinkHookPtr (*(uint24_t*)0xD02614)
 +
#define os_USBActiveHookPtr  (*(uint24_t*)0xD0261A)
 +
 
 +
#define os_tempFreeArc      (*(uint24_t*)0xD02655) /* Set after asm_ArcChk call */
 +
 
 +
#define os_textBGcolor      (*(uint16_t*)0xD02688)
 +
#define os_textFGcolor      (*(uint16_t*)0xD0268A)
 +
 
 +
#define os_drawBGColor      (*(uint16_t*)0xD026AA)
 +
#define os_drawFGColor      (*(uint16_t*)0xD026AC)
 +
#define os_drawColorCode    (*(uint8_t*)0xD026AE)
 +
 
 +
#define os_batteryStatus    (*(uint8_t*)0xD02A86)
 +
 
 +
#define os_graphBGColor      ((uint16_t*)0xD02A98)
 +
 
 +
#define os_fillRectColor    (*(uint16_t*)0xD02AC0)
 +
#define os_statusBarBGColor  ((uint16_t*)0xD02ACC)
  
 
/**
 
/**
  * Set the time of the calculator
+
  * ---- TI-OS Token definitions ----
 
  */
 
  */
void boot_SetTime(uint8_t seconds, uint8_t minutes, uint8_t hours);
+
#define tToDMS 0x01
 +
#define tToDEC 0x02
 +
#define tToAbc 0x03
 +
#define tStore 0x04 // ->
 +
#define tBoxPlot 0x05
 +
#define tLBrack 0x06 // '['
 +
#define tRBrack 0x07 // ']'
 +
#define tLBrace 0x08 // '{'
 +
#define tRBrace 0x09 // '}'
 +
#define tFromRad 0x0A
 +
#define tFromDeg 0x0B
 +
#define tRecip 0x0C
 +
#define tSqr 0x0D
 +
#define tTrnspos 0x0E
 +
#define tCube 0x0F // '^3'
 +
#define tLParen 0x10 // '('
 +
#define tRParen 0x11 // ')'
 +
#define tRound 0x12 // 'round'
 +
#define tPxTst 0x13 // 'PXL-TEST'
 +
#define tAug 0x14 // 'aug'
 +
#define tRowSwap 0x15 // 'rSwap'
 +
#define tRowPlu 0x16 // 'rAdd'
 +
#define tmRow 0x17 // 'multR'
 +
#define tmRowPlus 0x18 // 'mRAdd'
 +
#define tMax 0x19 // 'max'
 +
#define tMin 0x1A // 'min'
 +
#define tRToPr 0x1B // 'R>Pr'
 +
#define tRToPo 0x1C // 'R>Po'
 +
#define tPToRx 0x1D // 'P>Rx'
 +
#define tPToRy 0x1E // 'P>Ry'
 +
#define tMedian 0x1F // 'MEDIAN'
 +
#define tRandM 0x20 // 'randM'
 +
#define tMean 0x21 // 'MEAN'
 +
#define tRoot 0x22 // 'ROOT'
 +
#define tSeries 0x23 // 'seq'
 +
#define tFnInt 0x24 // 'fnInt'
 +
#define tNDeriv 0x25 // 'fnIr'
 +
#define tEvalF 0x26
 +
#define tFmin 0x27
 +
#define tFmax 0x28
 +
#define tSpace 0x29 // ' '
 +
#define tString 0x2A // '"'
 +
#define tComma 0x2B // ','
 +
#define tii 0x2C // 'i'
 +
#define tFact 0x2D // '!'
 +
#define tCubicR 0x2E
 +
#define tQuartR 0x2F
 +
#define t0 0x30
 +
#define t1 0x31
 +
#define t2 0x32
 +
#define t3 0x33
 +
#define t4 0x34
 +
#define t5 0x35
 +
#define t6 0x36
 +
#define t7 0x37
 +
#define t8 0x38
 +
#define t9 0x39
 +
#define tDecPt 0x3A // '.'
 +
#define tee 0x3B // 'e'
 +
#define tOr 0x3C // '_or_'
 +
#define tXor 0x3D
 +
#define tColon 0x3E // ':'
 +
#define tEnter 0x3F
 +
#define tAnd 0x40 // '_and_'
 +
#define tA 0x41
 +
#define tB 0x42
 +
#define tC 0x43
 +
#define tD 0x44
 +
#define tE 0x45
 +
#define tF 0x46
 +
#define tG 0x47
 +
#define tH 0x48
 +
#define tI 0x49
 +
#define tJ 0x4A
 +
#define tK 0x4B
 +
#define tL 0x4C
 +
#define tM 0x4D
 +
#define tN 0x4E
 +
#define tO 0x4F
 +
#define tP 0x50
 +
#define tQ 0x51
 +
#define tR 0x52
 +
#define tS 0x53
 +
#define tT 0x54
 +
#define tU 0x55
 +
#define tV 0x56
 +
#define tW 0x57
 +
#define tX 0x58
 +
#define tY 0x59
 +
#define tZ 0x5A
 +
#define tTheta 0x5B
  
 
/**
 
/**
  * High 8 is unsigned offset, low 8 is bits to test
+
  * Extended Tokens
* os_TestFlagBits will return a 0 or 1
+
 
  */
 
  */
int os_TestFlagBits(uint16_t offset_pattern);
+
#define tExtTok 0xEF
void os_SetFlagBits(int16_t offset_pattern);
+
#define tSetDate 0x00
void os_ResetFlagBits(int16_t offset_pattern);
+
#define tSetTime 0x01
 +
#define tCheckTmr 0x02
 +
#define tSetDtFmt 0x03
 +
#define tSetTmFmt 0x04
 +
#define tTimeCnv 0x05
 +
#define tDayOfWk 0x06
 +
#define tGetDtStr 0x07
 +
#define tGetTmStr 0x08
 +
#define tGetDate 0x09
 +
#define tGetTime 0x0A
 +
#define tStartTmr 0x0B
 +
#define tGtDtFmt 0x0C
 +
#define tGetTmFmt 0x0D
 +
#define tIsClockOn 0x0E
 +
#define tClockOff 0x0F
 +
#define tClockOn 0x10
 +
#define tOpenLib 0x11
 +
#define tExecLib 0x12
 +
#define tInvT 0x13
 +
#define tChiSquaredTest 0x14
 +
#define tLinRegTInt 0x15
 +
#define tManualFit 0x16
 +
#define tZQuadrant 0x17
 +
#define tZFracHalf 0x18
 +
#define tZFracThird 0x19
 +
#define tZFracFourth 0x1A
 +
#define tZFracFifth 0x1B
 +
#define tZFracEighth 0x1C
 +
#define tZFracTenth 0x1D
 +
#define tFracSlash 0x2E
 +
#define tFracMixedNum 0x2F
 +
#define tSwapImProper 0x30
 +
#define tSwapFracDec 0x31
 +
#define tRemainder 0x32
 +
#define tSummationSigma 0x33
 +
#define tLogBase 0x34
 +
#define tRandIntNoRep 0x35
 +
#define tMathPrint 0x36
 +
#define tClassic 0x38
 +
#define tAutoAnswer 0x3B
 +
#define tDecAnswer 0x3C
 +
#define tFracAnswer 0x3D
 +
#define tBlue 0x41
 +
#define tRed 0x42
 +
#define tBlack 0x43
 +
#define tMagenta 0x44
 +
#define tGreen 0x45
 +
#define tOrange 0x46
 +
#define tBrown 0x47
 +
#define tNavy 0x48
 +
#define tLtBlue 0x49
 +
#define tYellow 0x4A
 +
#define tWhite 0x4B
 +
#define tLtGray 0x4C
 +
#define tMedGray 0x4D
 +
#define tGray 0x4E
 +
#define tDarkGray 0x4F
 +
#define tGraphColor 0x65
 +
#define tTextColor 0x67
 +
#define tBackgroundOn 0x5B
 +
#define tBackgroundOff 0x64
 +
#define tThin 0x74
 +
#define tBorderColor 0x6C
 +
#define tAsm84CPrgm 0x68
 +
#define tAsm84CCmp 0x69
 +
#define tAsm84CeCmp 0x7B
 +
#define tAsm84CePrgm 0x7A
 +
 
 +
#define tVarMat 0x5C
 +
#define tVarLst 0x5D
 +
#define tVarEqu 0x5E
 +
#define tProg 0x5F
 +
#define tVarPict 0x60
 +
#define tVarGDB 0x61
 +
#define tVarOut 0x62
 +
#define tVarSys 0x63
  
 
/**
 
/**
  * Whole bunch of useful timer functions
+
  * Mode settings tokens
* Use the below defines to send to boot_SetTimersControlRegister
+
 
  */
 
  */
#define TIMER1_ENABLE 1 << 0 // Enables Timer 1
+
#define tRad 0x64 // 'Radian'
#define TIMER1_32K 1 << 1 // Use the 32K clock for timer 1
+
#define tDeg 0x65 // 'Degree'
#define TIMER1_CPU 0 << 1 // Use the CPU clock rate for timer 1
+
#define tNormF 0x66 // 'Normal'
#define TIMER1_INT 1 << 2 // Enable an interrupt for the timer 1
+
#define tSci 0x67 // 'Sci'
#define TIMER1_NOINT 0 << 2 // Disable interrupts for the timer 1
+
#define tEng 0x68 // 'Eng'
#define TIMER1_UP 1 << 9 // Timer 1 counts up
+
#define tFloat 0x69 // 'Float'
#define TIMER1_DOWN 0 << 9 // Timer 1 counts down
+
#define tFix 0x73 // 'Fix_'
 +
#define tSplitOn 0x74
 +
#define tFullScreen 0x75
 +
#define tStndrd 0x76 // 'Func'
 +
#define tParam 0x77 // 'Param'
 +
#define tPolar 0x78 // 'Pol'
 +
#define tSeqG 0x79 // ;79h
 +
#define tAFillOn 0x7A // 'AUTO FILL ON'
 +
#define tAFillOff 0x7B // 'AutoFill OFF'
 +
#define tACalcOn 0x7C
 +
#define tACalcOff 0x7D
  
#define TIMER2_ENABLE 1 << 3 // Enables Timer 2
+
#define tEQ 0x6A // '=='
#define TIMER2_32K 1 << 4 // Use the 32K clock for timer 2
+
#define tLT 0x6B // '<'
#define TIMER2_CPU 0 << 4 // Use the CPU clock rate for timer 2
+
#define tGT 0x6C // '>'
#define TIMER2_INT 1 << 5 // Enable an interrupt for the timer 2
+
#define tLE 0x6D // LLE
#define TIMER2_NOINT 0 << 5 // Disable interrupts for the timer 2
+
#define tGE 0x6E // LGE
#define TIMER2_UP 1 << 10 // Timer 2 counts up
+
#define tNE 0x6F // LNE
#define TIMER2_DOWN 0 << 10 // Timer 2 counts down
+
#define tAdd 0x70 // '+'
 +
#define tSub 0x71 // '-'
 +
#define tMul 0x82 // '*'
 +
#define tDiv 0x83 // '/'
 +
#define tAns 0x72
  
/* These defines can be used to check the status of the timer */
+
#define tBoxIcon 0x7F
#define TIMER1_MATCH1 1 << 0 // Timer 1 hit the first match value
+
#define tCrossIcon 0x80
#define TIMER1_MATCH2 1 << 1 // Timer 1 hit the second match value
+
#define tDotIcon 0x81
#define TIMER1_RELOADED 1 << 2 // Timer 1 was reloaded (Needs to have TIMER1_INT enabled)
+
  
#define TIMER2_MATCH1 1 << 3 // Timer 2 hit the first match value
+
#define tTrace 0x84 // 'Trace'
#define TIMER2_MATCH2 1 << 4 // Timer 2 hit the second match value
+
#define tClDrw 0x85 // 'ClDraw'
#define TIMER2_RELOADED 1 << 5 // Timer 2 was reloaded (Needs to have TIMER2_INT enabled)
+
#define tZoomStd 0x86 // 'ZStd'
 +
#define tZoomtrg 0x87 // 'Ztrg'
 +
#define tZoomBox 0x88 // 'ZBOX'
 +
#define tZoomIn 0x89 // 'ZIn'
 +
#define tZoomOut 0x8A // 'ZOut'
 +
#define tZoomSqr 0x8B // 'ZSqr'
 +
#define tZoomInt 0x8C // 'ZInt'
 +
#define tZoomPrev 0x8D // 'ZPrev'
 +
#define tZoomDec 0x8E // 'ZDecm'
 +
#define tZoomStat 0x8F // 'ZStat
 +
#define tUsrZm 0x90 // 'ZRcl'
 +
#define tPrtScrn 0x91 // 'PrtScrn'
 +
#define tZoomSto 0x92 //  'ZSto'
 +
#define tText 0x93
  
void boot_SetTimersControlRegister(uint16_t value);
+
#define tnPr 0x94 // '_nPr_'
uint16_t boot_GetTimersControlRegister(void);
+
#define tnCr 0x95 // '_nCr_'
void boot_SetTimersInterruptStatus(uint16_t value);
+
uint16_t boot_GetTimersInterruptStatus(void);
+
void boot_SetTimersInterruptMask(uint16_t value);
+
uint16_t boot_GetTimersInterruptMask(void);
+
void boot_SetTimer1Counter(uint32_t count);
+
uint32_t boot_GetTimer1Counter(void);
+
void boot_SetTimer1ReloadValue(uint32_t value);
+
uint32_t boot_GetTimer1ReloadValue(void);
+
void boot_SetTimer1MatchValue1(uint32_t value);
+
uint32_t boot_GetTimer1MatchValue1(void);
+
void boot_SetTimer1MatchValue2(uint32_t value);
+
uint32_t boot_GetTimer1MatchValue2(void);
+
void boot_SetTimer2Counter(uint32_t count);
+
uint32_t boot_GetTimer2Counter(void);
+
void boot_SetTimer2ReloadValue(uint32_t value);
+
uint32_t boot_GetTimer2ReloadValue(void);
+
void boot_SetTimer2MatchValue1(uint32_t value);
+
uint32_t boot_GetTimer2MatchValue1(void);
+
void boot_SetTimer2MatchValue2(uint32_t value);
+
uint32_t boot_GetTimer2MatchValue2(void);
+
  
/**
+
// Graph Commands
* Things you shouldn't use unless you know what you are doing
+
#define tYOn 0x96 // 'FnOn_'
  */
+
#define tYOff 0x97 // 'FnOff_'
void os_ForceCmdNoChar(void);
+
#define tStPic 0x98 // 'StPic_'
 +
#define tRcPic 0x99 // 'RcPic_'
 +
#define tStoDB 0x9A // 'StGDB_'
 +
#define tRclDB 0x9B // 'RcGDB_'
 +
#define tLine 0x9C // 'Line'
 +
#define tVert 0x9D // 'Vert_'
 +
#define tPtOn 0x9E // 'PtOn'
 +
#define tPtOff 0x9F // 'PtOff'
 +
#define tPtChg 0xA0 // 'PtChg'
 +
#define tPXOn 0xA1
 +
#define tPXOff 0xA2
 +
#define tPXChg 0xA3
 +
#define tShade 0xA4 // 'Shade'
 +
#define tCircle 0xA5 // 'Circle'
 +
#define tHorz 0xA6 // 'HORIZONTAL'
 +
#define tTanLn 0xA7 // 'TanLn'
 +
#define tDrInv 0xA8 // 'DrInv_'
 +
#define tDrawF 0xA9 // 'DrawF_'
 +
#define tVarStrng 0xAA
 +
 
 +
// Functions with No Argument
 +
#define tRand 0xAB // 'rand'
 +
#define tPi 0xAC // Lpi
 +
#define tGetKey 0xAD // 'getKy'
 +
#define tAPost 0xAE // '''
 +
#define tQuest 0xAF // '?'
 +
#define tChs 0xB0
 +
#define tInt 0xB1
 +
#define tAbs 0xB2
 +
#define tDet 0xB3
 +
#define tIdent 0xB4
 +
#define tDim 0xB5
 +
#define tSum 0xB6
 +
#define tProd 0xB7
 +
#define tNot 0xB8
 +
#define tIPart 0xB9
 +
#define tFPart 0xBA
 +
 
 +
// New 2 Byte Tokens
 +
#define t2ByteTok 0xBB
 +
#define tSqrt 0xBC
 +
#define tCubRt 0xBD
 +
#define tLn 0xBE
 +
#define tExp 0xBF
 +
#define tLog 0xC0
 +
#define tALog 0xC1
 +
#define tSin 0xC2
 +
#define tASin 0xC3
 +
#define tCos 0xC4
 +
#define tACos 0xC5
 +
#define tTan 0xC6
 +
#define tATan 0xC7
 +
#define tSinH 0xC8
 +
#define tASinH 0xC9
 +
#define tCoshH 0xCA
 +
#define tACosH 0xCB
 +
#define tTanH 0xCC
 +
#define tATanH 0xCD
  
 +
// Some Programming Commands
 +
#define tIf 0xCE // 'If_'
 +
#define tThen 0xCF // 'Then_'
 +
#define tElse 0xD0 // 'Else_'
 +
#define tWhile 0xD1 // 'While_'
 +
#define tRepeat 0xD2 // 'Repeat_'
 +
#define tFor 0xD3 // 'For_'
 +
#define tEnd 0xD4 // 'End'
 +
#define tReturn 0xD5 // 'Return'
 +
#define tLbl 0xD6 // 'Lbl_'
 +
#define tGoto 0xD7 // 'Goto_'
 +
#define tPause 0xD8 // 'Pause_'
 +
#define tStop 0xD9 // 'Stop'
 +
#define tISG 0xDA // 'IS>'
 +
#define tDSL 0xDB // 'DS<'
 +
#define tInput 0xDC // 'Input_'
 +
#define tPrompt 0xDD // 'Prompt_'
 +
#define tDisp 0xDE // 'Disp_'
 +
#define tDispG 0xDF // 'DispG'
 +
#define tOutput 0xE0 // 'Outpt'
 +
#define tClLCD 0xE1 // 'ClLCD'
 +
#define tConst 0xE2 // 'Fill'
 +
#define tSortA 0xE3 // 'sortA_'
 +
#define tSortD 0xE4 // 'sortD_'
 +
#define tDispTab 0xE5 // 'Disp Table
 +
#define tMenu 0xE6 // 'Menu'
 +
#define tSendMBL 0xE7 // 'Send'
 +
#define tGetMBL 0xE8 // 'Get'
 +
 +
// Stat Plot Commands
 +
#define tPlotOn 0xE9 // 'PLOTSON'
 +
#define tPlotOff 0xEA // 'PLOTSOFF
 +
#define tListName 0xEB // List Designator
 +
#define tPlot1 0xEC
 +
#define tPlot2 0xED
 +
#define tPlot3 0xEE
 +
#define tUnused01 0xEF // available?
 +
#define tPower 0xF0 // '^'
 +
#define tXRoot 0xF1 // LsupX,Lroot
 +
#define tOneVar 0xF2 // 'OneVar_'
 +
#define tTwoVar 0xF3
 +
#define tLR 0xF4 // 'LinR(A+BX)'
 +
#define tLRExp 0xF5 // 'ExpR_'
 +
#define tLRLn 0xF6 // 'LnR_'
 +
#define tLRPwr 0xF7 // 'PwrR_'
 +
#define tMedMed 0xF8
 +
#define tQuad 0xF9
 +
#define tClrLst 0xFA // 'Clear List'
 +
#define tClrTbl 0xFB // 'Clear Table'
 +
#define tHist 0xFC // 'Hist_'
 +
#define txyLine 0xFD // 'xyline_'
 +
#define tScatter 0xFE // 'Scatter_'
 +
#define tLR1 0xFF // 'LINR(AX+B)'
 +
 +
// 2nd Half Of Graph Format Tokens
 +
#define tSeq 0x00 // 'SeqG'
 +
#define tSimulG 0x01 // 'SimulG'
 +
#define tPolarG 0x02 // 'PolarGC'
 +
#define tRectG 0x03 // 'RectGC'
 +
#define tCoordOn 0x04 // 'CoordOn'
 +
#define tCoordOff 0x05 // 'CoordOff'
 +
#define tDrawLine 0x06 // 'DrawLine'
 +
#define tDrawDot 0x07 // 'DrawDot'
 +
#define tAxisOn 0x08 // 'AxesOn'
 +
#define tAxisOff 0x09 // 'AxesOff'
 +
#define tGridOn 0x0A // 'GridOn'
 +
#define tGridOff 0x0B // 'GridOff'
 +
#define tLblOn 0x0C // 'LabelOn'
 +
#define tLblOff 0x0D // 'LabelOff'
 +
#define tWebOn 0x0E // 'WebOn'
 +
#define tWebOff 0x0F // 'WebOFF'
 +
#define tuv 0x10 // U vs V
 +
#define tvw 0x11 // V vs W
 +
#define tuw 0x12 // U vs W
 +
 +
// 2nd Half Of User Matrix Tokens
 +
#define tMatA 0x00 // MAT A
 +
#define tMatB 0x01 // MAT B
 +
#define tMatC 0x02 // MAT C
 +
#define tMatD 0x03 // MAT D
 +
#define tMatE 0x04 // MAT E
 +
#define tMatF 0x05 // MAT F
 +
#define tMatG 0x06 // MAT G
 +
#define tMatH 0x07 // MAT H
 +
#define tMatI 0x08 // MAT I
 +
#define tMatJ 0x09 // MAT J
 +
 +
// 2nd Half Of User List Tokens
 +
#define tL1 0x00 // LIST 1
 +
#define tL2 0x01 // LIST 2
 +
#define tL3 0x02 // LIST 3
 +
#define tL4 0x03 // LIST 4
 +
#define tL5 0x04 // LIST 5
 +
#define tL6 0x05 // LIST 6
 +
 +
// 2nd Half Of User Equation Tokens
 +
// Y Equations have bit 4 set
 +
#define tY1 0x10 // Y1
 +
#define tY2 0x11 // Y2
 +
#define tY3 0x12 // Y3
 +
#define tY4 0x13 // Y4
 +
#define tY5 0x14 // Y5
 +
#define tY6 0x15 // Y6
 +
#define tY7 0x16 // Y7
 +
#define tY8 0x17 // Y8
 +
#define tY9 0x18 // Y9
 +
#define tY0 0x19 // Y0
 +
 +
// Param Equations Have Bit 5 Set
 +
#define tX1T 0x20 // X1t
 +
#define tY1T 0x21 // Y1t
 +
#define tX2T 0x22 // X2t
 +
#define tY2T 0x23 // Y2t
 +
#define tX3T 0x24 // X3t
 +
#define tY3T 0x25 // Y3t
 +
#define tX4T 0x26 // X4t
 +
#define tY4T 0x27 // Y4t
 +
#define tX5T 0x28 // X5t
 +
#define tY5T 0x29 // Y5t
 +
#define tX6T 0x2A // X6t
 +
#define tY6T 0x2B // Y6t
 +
 +
// Polar Equations Have Bit 6 Set
 +
#define tR1 0x40 // R1
 +
#define tR2 0x41 // R2
 +
#define tR3 0x42 // R3
 +
#define tR4 0x43 // R4
 +
#define tR5 0x44 // R5
 +
#define tR6 0x45 // R6
 +
 +
// Recursion Equations Have Bit 7 Set
 +
#define tun 0x80 // Un
 +
#define tvn 0x81 // Vn
 +
#define twn 0x82 // Wn
 +
 +
// 2nd Half User Picture Tokens
 +
#define tPic1 0x00 // PIC1
 +
#define tPic2 0x01 // PIC2
 +
#define tPic3 0x02 // PIC3
 +
#define tPic4 0x03 // PIC4
 +
#define tPic5 0x04 // PIC5
 +
#define tPic6 0x05 // PIC6
 +
#define tPic7 0x06 // PIC7
 +
#define tPic8 0x07 // PIC8
 +
#define tPic9 0x08 // PIC9
 +
#define tPic0 0x09 // PIC0
 +
 +
// 2nd Half User Graph Database Tokens
 +
#define tGDB1 0x00 // GDB1
 +
#define tGDB2 0x01 // GDB2
 +
#define tGDB3 0x02 // GDB3
 +
#define tGDB4 0x03 // GDB4
 +
#define tGDB5 0x04 // GDB5
 +
#define tGDB6 0x05 // GDB6
 +
#define tGDB7 0x06 // GDB7
 +
#define tGDB8 0x07 // GDB8
 +
#define tGDB9 0x08 // GDB9
 +
#define tGDB0 0x09 // GDB0
 +
 +
// 2nd Half Of String Vars
 +
#define tStr1 0x00
 +
#define tStr2 0x01
 +
#define tStr3 0x02
 +
#define tStr4 0x03
 +
#define tStr5 0x04
 +
#define tStr6 0x05
 +
#define tStr7 0x06
 +
#define tStr8 0x07
 +
#define tStr9 0x08
 +
#define tStr0 0x09
 +
 +
// 2nd Half Of System Output Only Variables
 +
#define tRegEq 0x01 // REGRESSION EQUATION
 +
#define tStatN 0x02 // STATISTICS N
 +
#define tXMean 0x03 // X MEAN
 +
#define tSumX 0x04 // SUM(X)
 +
#define tSumXSqr 0x05 // SUM(X^2)
 +
#define tStdX 0x06 // STANDARD DEV X
 +
#define tStdPX 0x07 // STANDARD DEV POP X
 +
#define tMinX 0x08 // Min X VALUE
 +
#define tMaxX 0x09 // Max X VALUE
 +
#define tMinY 0x0A // Min Y VALUE
 +
#define tMaxY 0x0B // Max Y VALUE
 +
#define tYmean 0x0C // Y MEAN
 +
#define tSumY 0x0D // SUM(Y)
 +
#define tSumYSqr 0x0E // SUM(Y^2)
 +
#define tStdY 0x0F // STANDARD DEV Y
 +
#define tStdPY 0x10 // STANDARD DEV POP Y
 +
#define tSumXY 0x11 // SUM(XY)
 +
#define tCorr 0x12 // CORRELATION
 +
#define tMedX 0x13 // MED(X)
 +
#define tQ1 0x14 // 1ST QUADRANT OF X
 +
#define tQ3 0x15 // 3RD QUADRANT OF X
 +
#define tQuadA 0x16 // 1ST TERM OF QUAD POLY REG/ Y-INT
 +
#define tQuadB 0x17 // 2ND TERM OF QUAD POLY REG/ SLOPE
 +
#define tQuadC 0x18 // 3RD TERM OF QUAD POLY REG
 +
#define tCubeD 0x19 // 4TH TERM OF CUBIC POLY REG
 +
#define tQuartE 0x1A // 5TH TERM OF QUART POLY REG
 +
#define tMedX1 0x1B // x1 FOR MED-MED
 +
#define tMedX2 0x1C // x2 FOR MED-MED
 +
#define tMedX3 0x1D // x3 FOR MED-MED
 +
#define tMedY1 0x1E // y1 FOR MED-MED
 +
#define tMedY2 0x1F // y2 FOR MED-MED
 +
#define tMedY3 0x20 // y3 FOR MED-MED
 +
#define tRecurn 0x21 // RECURSION N
 +
#define tStatP 0x22
 +
#define tStatZ 0x23
 +
#define tStatT 0x24
 +
#define tStatChi 0x25
 +
#define tStatF 0x26
 +
#define tStatDF 0x27
 +
#define tStatPhat 0x28
 +
#define tStatPhat1 0x29
 +
#define tStatPhat2 0x2A
 +
#define tStatMeanX1 0x2B
 +
#define tStatStdX1 0x2C
 +
#define tStatN1 0x2D
 +
#define tStatMeanX2 0x2E
 +
#define tStatStdX2 0x2F
 +
#define tStatN2 0x30
 +
#define tStatStdXP 0x31
 +
#define tStatLower 0x32
 +
#define tStatUpper 0x33
 +
#define tStat_s 0x34
 +
#define tLRSqr 0x35 // r^2
 +
#define tBRSqr 0x36 // R^2
 +
 +
// These next tokens are only used to access the data
 +
// They are display only and the user cannot access them at all
 +
#define tF_DF 0x37 // ANOFAV FACTOR DF
 +
#define tF_SS 0x38 // ANOFAV FACTOR SS
 +
#define tF_MS 0x39 // ANOFAV FACTOR MS
 +
#define tE_DF 0x3A // ANOFAV ERROR DF
 +
#define tE_SS 0x3B // ANOFAV ERROR SS
 +
#define tE_MS 0x3C // ANOFAV ERROR MS
 +
 +
// 2nd Half Of System Input/Output Variables
 +
#define tuXscl 0x00
 +
#define tuYscl 0x01
 +
#define tXscl 0x02
 +
#define tYscl 0x03
 +
#define tRecuru0 0x04 // U 1st Initial condition
 +
#define tRecurv0 0x05 // V 1st Initial condition
 +
#define tun1 0x06 // U(N-1); not used
 +
#define tvn1 0x07 // V(N-1); not used
 +
#define tuRecuru0 0x08
 +
#define tuRecurv0 0x09
 +
#define tXmin 0x0A
 +
#define tXmax 0x0B
 +
#define tYmin 0x0C
 +
#define tYmax 0x0D
 +
#define tTmin 0x0E
 +
#define tTmax 0x0F
 +
#define tThetaMin 0x10
 +
#define tThetaMax 0x11
 +
#define tuXmin 0x12
 +
#define tuXmax 0x13
 +
#define tuYmin 0x14
 +
#define tuYmax 0x15
 +
#define tuThetMin 0x16
 +
#define tuThetMax 0x17
 +
#define tuTmin 0x18
 +
#define tuTmax 0x19
 +
#define tTblMin 0x1A
 +
#define tPlotStart 0x1B
 +
#define tuPlotStart 0x1C
 +
#define tnMax 0x1D
 +
#define tunMax 0x1E
 +
#define tnMin 0x1F
 +
#define tunMin 0x20
 +
#define tTblStep 0x21
 +
#define tTStep 0x22
 +
#define tThetaStep 0x23
 +
#define tuTStep 0x24
 +
#define tuThetStep 0x25
 +
#define tDeltaX 0x26
 +
#define tDeltaY 0x27
 +
#define tXFact 0x28
 +
#define tYFact 0x29
 +
#define tTblInput 0x2A
 +
#define tFinN 0x2B
 +
#define tFinI 0x2C
 +
#define tFinPV 0x2D
 +
#define tFinPMT 0x2E
 +
#define tFinFV 0x2F
 +
#define tFinPY 0x30
 +
#define tFinCY 0x31
 +
#define tRecurw0 0x32 // w0(1)
 +
#define tuRecurw0 0x33
 +
#define tPlotStep 0x34
 +
#define tuPlotStep 0x35
 +
#define tXres 0x36
 +
#define tuXres 0x37
 +
#define tRecuru02 0x38 // u0(2)
 +
#define tuRecuru02 0x39
 +
#define tRecurv02 0x3C // v0(2)
 +
#define tuRecurv02 0x3D
 +
#define tRecurw02 0x3E // w0(2)
 +
#define tuRecurw02 0x3F
 +
 +
// 2nd Byte Of t2ByteTok Tokens
 +
#define tFinNPV 0x00
 +
#define tFinIRR 0x01
 +
#define tFinBAL 0x02
 +
#define tFinPRN 0x03
 +
#define tFinINT 0x04
 +
#define tFinToNom 0x05
 +
#define tFinToEff 0x06
 +
#define tFinDBD 0x07
 +
#define tLCM 0x08
 +
#define tGCD 0x09
 +
#define tRandInt 0x0A
 +
#define tRandBin 0x0B
 +
#define tSubStrng 0x0C
 +
#define tStdDev 0x0D
 +
#define tVariance 0x0E
 +
#define tInStrng 0x0F
 +
#define tDNormal 0x10
 +
#define tInvNorm 0x11
 +
#define tDT 0x12
 +
#define tChI 0x13
 +
#define tDF 0x14
 +
#define tBINPDF 0x15
 +
#define tBINCDF 0x16
 +
#define tPOIPDF 0x17
 +
#define tPOICDF 0x18
 +
#define tGEOPDF 0x19
 +
#define tGEOCDF 0x1A
 +
#define tNormalPDF 0x1B
 +
#define tTPDF 0x1C
 +
#define tChiPDF 0x1D
 +
#define tFPDF 0x1E
 +
#define tRandNorm 0x1F
 +
#define tFinFPMT 0x20
 +
#define tFinFI 0x21
 +
#define tFinFPV 0x22
 +
#define tFinFN 0x23
 +
#define tFinFFV 0x24
 +
#define tConj 0x25
 +
#define tReal 0x26
 +
#define tImag 0x27
 +
#define tAngle 0x28
 +
#define tCumSum 0x29
 +
#define tExpr 0x2A
 +
#define tLength 0x2B
 +
#define tDeltaLst 0x2C
 +
#define tRef 0x2D
 +
#define tRRef 0x2E
 +
#define tToRect 0x2F
 +
#define tToPolar 0x30
 +
#define tConste 0x31
 +
#define tSinReg 0x32
 +
#define tLogistic 0x33
 +
#define tLinRegTTest 0x34
 +
#define tShadeNorm 0x35
 +
#define tShadeT 0x36
 +
#define tShadeChi 0x37
 +
#define tShadeF 0x38
 +
#define tMatToLst 0x39
 +
#define tLstToMat 0x3A
 +
#define tZTest 0x3B
 +
#define tTTest 0x3C
 +
#define t2SampZTest 0x3D
 +
#define t1PropZTest 0x3E
 +
#define t2PropZTest 0x3F
 +
#define tChiTest 0x40
 +
#define tZIntVal 0x41
 +
#define t2SampZInt 0x42
 +
#define t1PropZInt 0x43
 +
#define t2PropZInt 0x44
 +
#define tGraphStyle 0x45
 +
#define t2SampTTest 0x46
 +
#define t2SampFTest 0x47
 +
#define tTIntVal 0x48
 +
#define t2SampTInt 0x49
 +
#define tSetupLst 0x4A
 +
#define tFinPMTend 0x4B
 +
#define tFinPMTbeg 0x4C
 +
#define tRealM 0x4D
 +
#define tPolarM 0x4E
 +
#define tRectM 0x4F
 +
#define tExprOn 0x50
 +
#define tExprOff 0x51
 +
#define tClrAllLst 0x52
 +
#define tGetCalc 0x53
 +
#define tDelVar 0x54
 +
#define tEquToStrng 0x55
 +
#define tStrngToequ 0x56
 +
#define tDelLast 0x57
 +
#define tSelect 0x58
 +
#define tANOVA 0x59
 +
#define tModBox 0x5A
 +
#define tNormProb 0x5B
 +
#define tMGT 0x64 // VERTICAL SPLIT
 +
#define tZFit 0x65 // ZOOM FIT
 +
#define tDiag_on 0x66 // DIANOSTIC DISPLAY ON
 +
#define tDiag_off 0x67 // DIANOSTIC DISPLAY OFF
 +
#define tArchive 0x68 // Archive
 +
#define tUnarchive 0x69 // UnArchive
 +
#define tAsm 0x6A
 +
#define tAsmComp 0x6B // asm compile
 +
#define tAsmPrgm 0x6C // Signifies a program is asm
 +
#define tAsmCmp 0x6D // asm program is compiled
 +
#define tLcapAAcute 0x6E
 +
#define tLcapAGrave 0x6F
 +
#define tLcapACaret 0x70
 +
#define tLcapADier 0x71
 +
#define tLaAcute 0x72
 +
#define tLaGrave 0x73
 +
#define tLaCaret 0x74
 +
#define tLaDier 0x75
 +
#define tLcapEAcute 0x76
 +
#define tLcapEGrave 0x77
 +
#define tLcapECaret 0x78
 +
#define tLcapEDier 0x79
 +
#define tLeAcute 0x7A
 +
#define tLeGrave 0x7B
 +
#define tLeCaret 0x7C
 +
#define tLeDier 0x7D
 +
#define tLcapIGrave 0x7F
 +
#define tLcapICaret 0x80
 +
#define tLcapIDier 0x81
 +
#define tLiAcute 0x82
 +
#define tLiGrave 0x83
 +
#define tLiCaret 0x84
 +
#define tLiDier 0x85
 +
#define tLcapOAcute 0x86
 +
#define tLcapOGrave 0x87
 +
#define tLcapOCaret 0x88
 +
#define tLcapODier 0x89
 +
#define tLoAcute 0x8A
 +
#define tLoGrave 0x8B
 +
#define tLoCaret 0x8C
 +
#define tLoDier 0x8D
 +
#define tLcapUAcute 0x8E
 +
#define tLcapUGrave 0x8F
 +
#define tLcapUCaret 0x90
 +
#define tLcapUDier 0x91
 +
#define tLuAcute 0x92
 +
#define tLuGrave 0x93
 +
#define tLuCaret 0x94
 +
#define tLuDier 0x95
 +
#define tLcapCCed 0x96
 +
#define tLcCed 0x97
 +
#define tLcapNTilde 0x98
 +
#define tLnTilde 0x99
 +
#define tLaccent 0x9A
 +
#define tLgrave 0x9B
 +
#define tLdieresis 0x9C
 +
#define tLquesDown 0x9D
 +
#define tLexclamDown 0x9E
 +
#define tLalpha 0x9F
 +
#define tLbeta 0xA0
 +
#define tLgamma 0xA1
 +
#define tLcapDelta 0xA2
 +
#define tLdelta 0xA3
 +
#define tLepsilon 0xA4
 +
#define tLlambda 0xA5
 +
#define tLmu 0xA6
 +
#define tLpi 0xA7
 +
#define tLrho 0xA8
 +
#define tLcapSigma 0xA9
 +
#define tLphi 0xAB
 +
#define tLcapOmega 0xAC
 +
#define tLphat 0xAD
 +
#define tLchi 0xAE
 +
#define tLstatF 0xAF
 +
#define tLa 0xB0
 +
#define tLb 0xB1
 +
#define tLc 0xB2
 +
#define tLd 0xB3
 +
#define tLsmalle 0xB4
 +
#define tLf 0xB5
 +
#define tLsmallg 0xB6
 +
#define tLh 0xB7
 +
#define tLi 0xB8
 +
#define tLj 0xB9
 +
#define tLk 0xBA
 +
#define tLl 0xBC
 +
#define tLm 0xBD
 +
#define tLsmalln 0xBE
 +
#define tLo 0xBF
 +
#define tLp 0xC0
 +
#define tLq 0xC1
 +
#define tLsmallr 0xC2
 +
#define tLs 0xC3
 +
#define tLsmallt 0xC4
 +
#define tLu 0xC5
 +
#define tLv 0xC6
 +
#define tLw 0xC7
 +
#define tLx 0xC8
 +
#define tLy 0xC9
 +
#define tLz 0xCA
 +
#define tLsigma 0xCB
 +
#define tLtau 0xCC
 +
#define tLcapIAcute 0xCD
 +
#define tGarbageCollect 0xCE
 +
 +
// 2 byte extended tokens (tExtTok) present in OS 5.2 and above
 +
#define tSEQn 0x8F // 'SEQ(n)'
 +
#define tSEQn1 0x90 // 'SEQ(n+1)'
 +
#define tSEQn2 0x91 // 'SEQ(n+2)'
 +
#define tLEFT 0x92 // 'LEFT'
 +
#define tCENTER 0x93 // 'CENTER'
 +
#define tRIGHT 0x94 // 'RIGHT'
 +
#define tInvBinom 0x95 // 'invBinom('
 +
#define tWait 0x96 // 'Wait_'
 +
#define tToString 0x97 // 'toString('
 +
#define tEval 0x98 // 'eval('
  
 
/**
 
/**
  * Use this function to call assembly functions in the OS and Bootcode
+
  * --- TIOS System error codes ---
* i.e. _OS( asm_HomeUp );
+
 
  */
 
  */
void _OS(void *function);
+
#define OS_E_EDIT          1<<7
 +
#define OS_E_MASK          0x7F
 +
#define OS_E_OVERFLOW      1+OS_E_EDIT
 +
#define OS_E_DIVBY0        2+OS_E_EDIT
 +
#define OS_E_SINGULARMAT    3+OS_E_EDIT
 +
#define OS_E_DOMAIN        4+OS_E_EDIT
 +
#define OS_E_INCREMENT      5+OS_E_EDIT
 +
#define OS_E_BREAK          6+OS_E_EDIT
 +
#define OS_E_NONREAL        7+OS_E_EDIT
 +
#define OS_E_SYNTAX        8+OS_E_EDIT
 +
#define OS_E_DATATYPE      9+OS_E_EDIT
 +
#define OS_E_ARGUMENT      10+OS_E_EDIT
 +
#define OS_E_DIMMISMATCH    11+OS_E_EDIT
 +
#define OS_E_DIMENSION      12+OS_E_EDIT
 +
#define OS_E_UNDEFINED      13+OS_E_EDIT
 +
#define OS_E_MEMORY        14+OS_E_EDIT
 +
#define OS_E_INVALID        15+OS_E_EDIT
 +
#define OS_E_ILLEGALNEST    16+OS_E_EDIT
 +
#define OS_E_BOUND          17+OS_E_EDIT
 +
#define OS_E_GRAPHRANGE    18+OS_E_EDIT
 +
#define OS_E_ZOOM          19+OS_E_EDIT
 +
#define OS_E_LABEL          20
 +
#define OS_E_STAT          21
 +
#define OS_E_SOLVER        22+OS_E_EDIT
 +
#define OS_E_SINGULARITY    23+OS_E_EDIT
 +
#define OS_E_SIGNCHANGE    24+OS_E_EDIT
 +
#define OS_E_ITERATIONS    25+OS_E_EDIT
 +
#define OS_E_BADGUESS      26+OS_E_EDIT
 +
#define OS_E_STATPLOT      27
 +
#define OS_E_TOLTOOSMALL    28+OS_E_EDIT
 +
#define OS_E_RESERVED      29+OS_E_EDIT
 +
#define OS_E_MODE          30+OS_E_EDIT
 +
#define OS_E_LNKERR        31+OS_E_EDIT
 +
#define OS_E_LNKMEMERR      32+OS_E_EDIT
 +
#define OS_E_LNKTRANSERR    33+OS_E_EDIT
 +
#define OS_E_LNKDUPERR      34+OS_E_EDIT
 +
#define OS_E_LNKMEMFULL    35+OS_E_EDIT
 +
#define OS_E_UNKNOWN        36+OS_E_EDIT
 +
#define OS_E_SCALE          37+OS_E_EDIT
 +
#define OS_E_IDNOTFOUND    38
 +
#define OS_E_NOMODE        39+OS_E_EDIT
 +
#define OS_E_VALIDATION    40
 +
#define OS_E_LENGTH        41+OS_E_EDIT
 +
#define OS_E_APPLICATION    42+OS_E_EDIT
 +
#define OS_E_APPERR1        43+OS_E_EDIT
 +
#define OS_E_APPERR2        44+OS_E_EDIT
 +
#define OS_E_EXPIREDAPP    45
 +
#define OS_E_BADADD        46
 +
#define OS_E_ARCHIVED      47+OS_E_EDIT
 +
#define OS_E_VERSION        48
 +
#define OS_E_ARCHFULL      49
 +
#define OS_E_VARIABLE      50+OS_E_EDIT
 +
#define OS_E_DUPLICATE      51+OS_E_EDIT
  
 
/**
 
/**
  * Assembly functions ( Don't forget to call from _OS() )
+
  * --- TI-OS os_GetCSC Scan Code Return Values ---
 
  */
 
  */
void asm_MoveUp(void);
+
#define sk_Down            0x01
void asm_MoveDown(void);
+
#define sk_Left            0x02
void asm_HomeUp(void);
+
#define sk_Right            0x03
void asm_RunIndicOn(void);
+
#define sk_Up              0x04
void asm_RunIndicOff(void);
+
#define sk_Enter            0x09
void asm_DisableAPD(void);
+
#define sk_2nd              0x36
void asm_EnableAPD(void);
+
#define sk_Clear            0x0F
 
+
#define sk_Alpha            0x30
#endif
+
#define sk_Add              0x0A
</pre>
+
#define sk_Sub              0x0B
 
+
#define sk_Mul              0x0C
= C Function Locations and definitions =
+
#define sk_Div              0x0D
 
+
#define sk_Graph            0x31
<pre>; C Functions present in the CE OS and Bootcode
+
#define sk_Trace            0x32
 
+
#define sk_Zoom            0x33
; === External Definitions ===================
+
#define sk_Window          0x34
    .assume ADL=1
+
#define sk_Yequ            0x35
    .def _boot_GetBootVerMajor
+
#define sk_Mode            0x37
    .def _boot_GetHardwareVers
+
#define sk_Del              0x38
    .def _boot_GetBootVerMinor
+
#define sk_Store            0x2A
    .def _boot_DebugPrintf
+
#define sk_Ln              0x2B
    .def _boot_ClearVRAM
+
#define sk_Log              0x2C
    .def _boot_TurnOff
+
#define sk_Square          0x2D
    .def _boot_NewLine
+
#define sk_Recip            0x2E
    .def _boot_PrintBootVersion
+
#define sk_Math            0x2F
    .def _boot_Set6MHzMode
+
#define sk_0                0x21
    .def _boot_Set48MHzMode
+
#define sk_1                0x22
    .def _boot_Set6MHzModeI
+
#define sk_4                0x23
    .def _boot_Set48MHzModeI
+
#define sk_7                0x24
    .def _boot_GetBatteryStatus
+
#define sk_2                0x1A
    .def _boot_WaitShort
+
#define sk_5                0x1B
    .def _boot_DoNothing1, _boot_DoNothing2
+
#define sk_8                0x1C
    .def _boot_USBPowered
+
#define sk_3                0x12
    .def _boot_NotPlugTypeA
+
#define sk_6                0x13
    .def _boot_SetTimersControlRegister
+
#define sk_9                0x14
    .def _boot_GetTimersControlRegister
+
#define sk_Comma            0x25
    .def _boot_SetTimersInterruptStatus
+
#define sk_Sin              0x26
    .def _boot_GetTimersInterruptStatus
+
#define sk_Apps            0x27
    .def _boot_SetTimersInterruptMask
+
#define sk_GraphVar        0x28
    .def _boot_GetTimersInterruptMask
+
#define sk_DecPnt          0x19
    .def _boot_SetTimer1Counter
+
#define sk_LParen          0x1D
    .def _boot_GetTimer1Counter
+
#define sk_Cos              0x1E
    .def _boot_SetTimer1ReloadValue
+
#define sk_Prgm            0x1F
    .def _boot_GetTimer1ReloadValue
+
#define sk_Stat            0x20
    .def _boot_SetTimer1MatchValue1
+
#define sk_Chs              0x10
    .def _boot_GetTimer1MatchValue1
+
#define sk_RParen          0x15
    .def _boot_SetTimer1MatchValue2
+
#define sk_Tan              0x16
    .def _boot_GetTimer1MatchValue2
+
#define sk_Vars            0x17
    .def _boot_SetTimer2Counter
+
#define sk_Power            0x0E
    .def _boot_GetTimer2Counter
+
    .def _boot_SetTimer2ReloadValue
+
    .def _boot_GetTimer2ReloadValue
+
    .def _boot_SetTimer2MatchValue1
+
    .def _boot_GetTimer2MatchValue1
+
    .def _boot_SetTimer2MatchValue2
+
    .def _boot_GetTimer2MatchValue2
+
    .def _boot_CheckOnPressed
+
    .def _boot_SetTime
+
    .def _os_ThrowError
+
    .def _os_RealCopy
+
    .def _os_RealAsinRad
+
    .def _os_RealAcosRad
+
    .def _os_RealAtanRad
+
    .def _os_RealAdd
+
    .def _os_CplxSquare
+
    .def _os_RealCompare
+
    .def _os_RealCosRad
+
    .def _os_RealRadToDeg
+
    .def _os_RealDiv
+
    .def _os_RealExp
+
    .def _os_RealFloor
+
    .def _os_RealToStr
+
    .def _os_RealFrac
+
    .def _os_RealGcd
+
    .def _os_RealRoundInt
+
    .def _os_RealLcm
+
    .def _os_RealLog
+
    .def _os_RealMax
+
    .def _os_RealMin
+
    .def _os_RealMul
+
    .def _os_RealNcr
+
    .def _os_RealNeg
+
    .def _os_RealNpr
+
    .def _os_RealPow
+
    .def _os_RealDegToRad
+
    .def _os_RealRandInt
+
    .def _os_RealInv
+
    .def _os_RealMod
+
    .def _os_RealRound
+
    .def _os_RealSinRad
+
    .def _os_RealSqrt
+
    .def _os_RealSub
+
    .def _os_RealTanRad
+
    .def _os_StrToReal
+
    .def _os_RealInt
+
    .def _os_SetFlagBits
+
    .def _os_ResetFlagBits
+
    .def _os_TestFlagBits
+
    .def _os_SetFlagByte
+
    .def _os_GetFlagByte
+
    .def _os_GetCursorPos
+
    .def _os_PutStrFull
+
    .def _os_PutStrLine
+
    .def _os_SetCursorPos
+
    .def _os_GetKey
+
    .def _os_GetCSC
+
    .def _os_DisableCursor
+
    .def _os_EnableCursor
+
    .def _os_FontDrawText
+
    .def _os_FontGetHeight
+
    .def _os_FontGetWidth
+
    .def _os_InitDrawing
+
    .def _os_SetDrawBGColor
+
    .def _os_SetDrawFGColor
+
    .def _os_FontSelect
+
    .def _os_GetDrawBGColor_BROKEN
+
    .def _os_GetDrawFGColor
+
    .def _os_FontGetID
+
    .def _os_ForceCmdNoChar
+
    .def _os_GetSymTablePtr
+
    .def _os_NextSymEntry
+
    .def _os_ChkFindSym
+
    .def _os_MemChk
+
    .def _os_FontDrawTransText
+
    .def _os_CreateAppVar
+
; ============================================
+
  
; === Location Equates =======================
+
#endif</pre>
_boot_GetBootVerMajor          equ 000080h
+
_boot_GetHardwareVers          equ 000084h
+
_boot_GetBootVerMinor          equ 00008Ch
+
_boot_DebugPrintf              equ 0000B4h
+
_boot_ClearVRAM                equ 000374h
+
_boot_TurnOff                  equ 000388h
+
_boot_NewLine                  equ 000390h
+
_boot_PrintBootVersion          equ 000394h
+
_boot_Set6MHzMode              equ 00039Ch
+
_boot_Set48MHzMode              equ 0003A0h
+
_boot_Set6MHzModeI              equ 0003A4h
+
_boot_Set48MHzModeI            equ 0003A8h
+
_boot_GetBatteryStatus          equ 0003B0h
+
_boot_WaitShort                equ 0003B4h
+
_boot_DoNothing1                equ 0003D8h
+
_boot_DoNothing2                equ 0003DCh
+
_boot_USBPowered                equ 0003E4h
+
_boot_NotPlugTypeA              equ 0003E8h
+
_boot_SetTimersControlRegister  equ 000520h
+
_boot_GetTimersControlRegister  equ 000524h
+
_boot_SetTimersInterruptStatus  equ 000528h
+
_boot_GetTimersInterruptStatus  equ 00052Ch
+
_boot_SetTimersInterruptMask    equ 000530h
+
_boot_GetTimersInterruptMask    equ 000534h
+
_boot_SetTimer1Counter          equ 000538h
+
_boot_GetTimer1Counter          equ 00053Ch
+
_boot_SetTimer1ReloadValue      equ 000540h
+
_boot_GetTimer1ReloadValue      equ 000544h
+
_boot_SetTimer1MatchValue1      equ 000548h
+
_boot_GetTimer1MatchValue1      equ 00054Ch
+
_boot_SetTimer1MatchValue2      equ 000550h
+
_boot_GetTimer1MatchValue2      equ 000554h
+
_boot_SetTimer2Counter          equ 000558h
+
_boot_GetTimer2Counter          equ 00055Ch
+
_boot_SetTimer2ReloadValue      equ 000560h
+
_boot_GetTimer2ReloadValue      equ 000564h
+
_boot_SetTimer2MatchValue1      equ 000568h
+
_boot_GetTimer2MatchValue1      equ 00056Ch
+
_boot_SetTimer2MatchValue2      equ 000570h
+
_boot_GetTimer2MatchValue2      equ 000574h
+
_boot_CheckOnPressed            equ 00057Ch
+
_boot_SetTime                  equ 0005B4h
+
_os_ThrowError                  equ 021C80h
+
_os_RealCopy                    equ 021C84h
+
_os_RealAsinRad                equ 021C88h
+
_os_RealAcosRad                equ 021C8Ch
+
_os_RealAtanRad                equ 021C90h
+
_os_RealAdd                    equ 021C94h
+
_os_CplxSquare                  equ 021C98h
+
_os_RealCompare                equ 021C9Ch
+
_os_RealCosRad                  equ 021CA0h
+
_os_RealRadToDeg                equ 021CA4h
+
_os_RealDiv                    equ 021CA8h
+
_os_RealExp                    equ 021CACh
+
_os_RealFloor                  equ 021CB0h
+
_os_RealToStr                  equ 021CB4h
+
_os_RealFrac                    equ 021CB8h
+
_os_RealGcd                    equ 021CBCh
+
_os_RealRoundInt                equ 021CC0h
+
_os_RealLcm                    equ 021CC4h
+
_os_RealLog                    equ 021CC8h
+
_os_RealMax                    equ 021CCCh
+
_os_RealMin                    equ 021CD0h
+
_os_RealMul                    equ 021CD4h
+
_os_RealNcr                    equ 021CD8h
+
_os_RealNeg                    equ 021CDCh
+
_os_RealNpr                    equ 021CE0h
+
_os_RealPow                    equ 021CE4h
+
_os_RealDegToRad                equ 021CE8h
+
_os_RealRandInt                equ 021CECh
+
_os_RealInv                    equ 021CF0h
+
_os_RealMod                    equ 021CF4h
+
_os_RealRound                  equ 021CF8h
+
_os_RealSinRad                  equ 021CFCh
+
_os_RealSqrt                    equ 021D00h
+
_os_RealSub                    equ 021D04h
+
_os_RealTanRad                  equ 021D08h
+
_os_StrToReal                  equ 021D0Ch
+
_os_RealInt                    equ 021D10h
+
_os_SetFlagBits                equ 021D14h
+
_os_ResetFlagBits              equ 021D18h
+
_os_TestFlagBits                equ 021D1Ch
+
_os_SetFlagByte                equ 021D20h
+
_os_GetFlagByte                equ 021D24h
+
_os_GetCursorPos                equ 021D28h
+
_os_PutStrFull                  equ 021D2Ch
+
_os_PutStrLine                  equ 021D30h
+
_os_SetCursorPos                equ 021D34h
+
_os_GetKey                      equ 021D38h
+
_os_GetCSC                      equ 021D3Ch
+
_os_DisableCursor              equ 021DE4h
+
_os_EnableCursor                equ 021DE8h
+
_os_FontDrawText                equ 021E00h
+
_os_FontGetHeight              equ 021E14h
+
_os_FontGetWidth                equ 021E18h
+
_os_InitDrawing                equ 021E1Ch
+
_os_SetDrawBGColor              equ 021E20h
+
_os_SetDrawFGColor              equ 021E24h
+
_os_FontSelect                  equ 021E28h
+
_os_GetDrawBGColor_BROKEN      equ 021EE4h ; doesn't work due to bug (needs to be ld hl.sis)
+
_os_GetDrawFGColor              equ 021EE8h
+
_os_FontGetID                  equ 021EECh
+
_os_ForceCmdNoChar              equ 021FA8h
+
_os_GetSymTablePtr              equ 021FB0h
+
_os_NextSymEntry                equ 021FB4h
+
_os_ChkFindSym                  equ 021FB8h
+
_os_MemChk                      equ 021FF0h
+
_os_FontDrawTransText          equ 022178h
+
_os_CreateAppVar                equ 022184h
+
; ============================================</pre>
+

Revision as of 22:34, 24 October 2016

C Definitions

// Parts from Matt "MateoConLechuga" Waltz and Jacob "jacobly" Young, in addtion to
// contributors of http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File
// Latest as of October 2016

#ifndef TICE_H
#define TICE_H

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>


/************* HARDWARE AND CUSTOM ROUTINES *************/


/* Creates a random integer value */
#define randInt(min, max)   (unsigned)rand() % ((max) - (min) + 1) + (min))

/* RTC define -- useful for srand() */
#define rtc_Time()          (*(volatile uint32_t*)0xF30044)

/* RTC definitions */
#define RTC_UNFREEZE        (1<<7)
#define RTC_FREEZE          (0<<7)
#define RTC_LOAD            (1<<6)
#define RTC_ENABLE          (1<<0)|RTC_UNFREEZE
#define RTC_DISABLE         (0<<0)

/* RTC registers */
#define rtc_Seconds         (*(volatile uint8_t*)0xF30000)
#define rtc_Minutes         (*(volatile uint8_t*)0xF30004)
#define rtc_Hours           (*(volatile uint8_t*)0xF30008)
#define rtc_Days            (*(volatile uint16_t*)0xF3000C)
#define rtc_AlarmSeconds    (*(uint8_t*)0xF30010)
#define rtc_AlarmMinutes    (*(uint8_t*)0xF30014)
#define rtc_AlarmHours      (*(uint8_t*)0xF30018)
#define rtc_Control         (*(uint8_t*)0xF30020)
#define rtc_LoadSeconds     (*(uint8_t*)0xF30024)
#define rtc_LoadMinutes     (*(uint8_t*)0xF30028)
#define rtc_LoadHours       (*(uint8_t*)0xF3002C)
#define rtc_LoadDays        (*(uint16_t*)0xF30030)
#define rtc_IntStatus       (*(volatile uint8_t*)0xF30034)
#define rtc_IntAcknowledge  (*(volatile uint8_t*)0xF30034)
#define rtc_IsBusy()        (rtc_Control & RTC_LOAD)

/* RTC interrupt masks */
#define RTC_ALARM_INT_SOURCE    (1<<5)
#define RTC_DAY_INT_SOURCE      (1<<4)
#define RTC_HR_INT_SOURCE       (1<<3)
#define RTC_MIN_INT_SOURCE      (1<<2)
#define RTC_SEC_INT_SOURCE      (1<<1)

/* RTC interrupt statuses */
#define RTC_LOAD_INT            (1<<5)
#define RTC_ALARM_INT           (1<<4)
#define RTC_DAY_INT             (1<<3)
#define RTC_HR_INT              (1<<2)
#define RTC_MIN_INT             (1<<1)
#define RTC_SEC_INT             (1<<0)
#define RTC_INT_MASK            (RTC_SEC_INT | RTC_MIN_INT | RTC_HR_INT | RTC_DAY_INT | RTC_ALARM_INT | RTC_LOAD_INT)

/* Whole bunch of useful timer functions */
#define TIMER1_ENABLE	1 << 0	// Enables Timer 1
#define TIMER1_DISABLE	0 << 0	// Disables Timer 1
#define TIMER1_32K	1 << 1	// Use the 32K clock for timer 1
#define TIMER1_CPU	0 << 1	// Use the CPU clock rate for timer 1
#define TIMER1_0INT	1 << 2	// Enable an interrupt when 0 is reached for the timer 1
#define TIMER1_NOINT	0 << 2	// Disable interrupts for the timer 1
#define TIMER1_UP	1 << 9	// Timer 1 counts up
#define TIMER1_DOWN	0 << 9	// Timer 1 counts down

#define TIMER2_ENABLE	1 << 3	// Enables Timer 2
#define TIMER2_DISABLE	0 << 3	// Enables Timer 2
#define TIMER2_32K	1 << 4	// Use the 32K clock for timer 2
#define TIMER2_CPU	0 << 4	// Use the CPU clock rate for timer 2
#define TIMER2_0INT	1 << 5	// Enable an interrupt when 0 is reached for the timer 2
#define TIMER2_NOINT	0 << 5	// Disable interrupts for the timer 2
#define TIMER2_UP	1 << 10	// Timer 2 counts up
#define TIMER2_DOWN	0 << 10	// Timer 2 counts down

/* These defines can be used to check the status of the timer */
#define TIMER1_MATCH1	1 << 0	// Timer 1 hit the first match value
#define TIMER1_MATCH2	1 << 1	// Timer 1 hit the second match value
#define TIMER1_RELOADED	1 << 2	// Timer 1 was reloaded (Needs to have TIMER1_0INT enabled)

#define TIMER2_MATCH1	1 << 3	// Timer 2 hit the first match value
#define TIMER2_MATCH2	1 << 4	// Timer 2 hit the second match value
#define TIMER2_RELOADED	1 << 5	// Timer 2 was reloaded (Needs to have TIMER2_0INT enabled)

/* Timer registers */
#define timer_1_Counter		(*(volatile uint32_t *)0xF20000)
#define timer_2_Counter		(*(volatile uint32_t *)0xF20010)
#define timer_1_ReloadValue	(*(uint32_t *)0xF20004)
#define timer_2_ReloadValue	(*(uint32_t *)0xF20014)
#define timer_1_MatchValue_1	(*(uint32_t *)0xF20008) 
#define timer_1_MatchValue_2	(*(uint32_t *)0xF2000C)
#define timer_2_MatchValue_1	(*(uint32_t *)0xF20018)
#define timer_2_MatchValue_2	(*(uint32_t *)0xF2001C)
#define timer_Control		(*(uint32_t *)0xF20030)
#define timer_EnableInt		(*(uint16_t *)0xF20038)
#define timer_IntStatus		(*(volatile uint16_t *)0xF20034)
#define timer_IntAcknowledge	(*(volatile uint16_t *)0xF20034)

/* LCD defines */
#define lcd_BacklightLevel      (*(uint8_t*)0xF60024)

/* OS varaible type definitions */
typedef struct { int8_t sign, exp; uint8_t mant[7]; } real_t;
typedef struct { real_t real, imag; } cplx_t;
typedef struct { uint16_t dim; real_t items[1]; } list_t;
typedef struct { uint16_t dim; cplx_t items[1]; } cplx_list_t;
typedef struct { uint8_t cols, rows; real_t items[1]; } matrix_t;
typedef struct { uint16_t len; char data[1]; } string_t;
typedef struct { uint16_t len; char data[1]; } equ_t;
typedef struct { uint16_t size; uint8_t data[1]; } var_t;

#define matrix_element(matrix, row, col) ((matrix)->items[(row)+(col)*(matrix)->rows])
#define NEG_SIGN_MASK    0x80
#define POS_SIGN_MASK    0x00
#define CPLX_SIGN_MASK   0x0C

/* Cleans up everything and gets ready to enter back to the OS when you are ready to exit your program */
void prgm_CleanUp(void);
#define pgrm_CleanUp prgm_CleanUp

/* A faster implementation of memset */
void *memset_fast(void *ptr,int value,size_t num);


/************* TI OS SPECIFIC ROUTINES AND IMPLEMENTATIONS *************/


/**
 * Resets the RTC back to its original values
 * If enable is true, the RTC will be enabled during this function
 */
void boot_RTCInitialize(bool enable);

/**
 * Returns the Bootcode version major
 */
uint8_t boot_GetBootVerMajor(void);

/**
 * Returns the Bootcode version minor
 */
uint8_t boot_GetBootVerMinor(void);

/**
 * Returns the Harware version
 */
uint8_t boot_GetHardwareVers(void);

/**
 * Turns all of VRAM into 0xFF (white)
 */
void boot_ClearVRAM(void);

/**
 * Checks if the [on] key was pressed
 */
bool boot_CheckOnPressed(void);

/** 
 * Basically a reimplemented form of printf that prints to some debugging device
 */
void boot_DebugPrintf(const char *string);

/**
 * Turns off the calculator (probably not a good idea to use)
 */
void boot_TurnOff(void);

/**
 * Inserts a new line at the current cursor posistion on the homescreen
 */
void boot_NewLine(void);

/**
 * Prints the boot version at a really silly place on the homescreen
 */
void boot_PrintBootVersion(void);

/**
 * Returns the current battery status
 */
uint8_t boot_GetBatteryStatus(void);

/**
 * Waits for 10 ms
 */
void boot_WaitShort(void);

/**
 * Set the time of the calculator
 */
void boot_SetTime(uint8_t seconds, uint8_t minutes, uint8_t hours);

/**
 * Disables the OS cursor
 */
void os_DisableCursor(void);

/**
 * Enables the OS cursor
 */
void os_EnableCursor(void);

/**
 * Set/Get the foreground color used to draw text on the graphscreen
 */
void os_SetDrawFGColor(int color);
uint24_t os_GetDrawFGColor(void);

/**
 * Set/Get the backgroundground color used to draw text on the graphscreen
 * os_GetDrawBGColor is only useable in OS 5.2 and above; use at your own risk
 */
void os_SetDrawBGColor(uint24_t color);
uint24_t os_GetDrawBGColor(void);

/**
 * Set/Get the cursor posistion used on the homescreen
 */
void os_SetCursorPos(uint8_t curRow, uint8_t curCol);
void os_GetCursorPos(uint8_t **curRow, uint8_t **curCol);

/**
 * Selects/Gets the font to use when drawing on the graphscreen
 * 0: small font
 * 1: large monospace font
 */
void os_FontSelect(char id);
uint24_t os_FontGetID(void);

/**
 * Returns the width of a string in the varaible-width format
 * Second function is used to get the height of the characters
 */
uint24_t os_FontGetWidth(const char *string);
uint24_t os_FontGetHeight(void);

/**
 * Draws a text using the small font to the screen
 * Returns the end column
 */
uint24_t os_FontDrawText(const char *string, uint16_t col, uint8_t row);
uint24_t os_FontDrawTransText(const char *string, uint16_t col, uint8_t row);

/**
 * Puts some text at the current homescreen cursor location
 * Returns 1 if string fits on screen, 0 otherwise
 */
uint24_t os_PutStrFull(const char *string);

/**
 * Puts some text at the current homescreen cursor location
 * Returns 1 if string fits on line, 0 otherwise
 */
uint24_t os_PutStrLine(const char *string);

/**
 * Set/Get a particular flag variable
 */
void os_SetFlagByte(int offset, uint8_t set);
uint8_t os_GetFlagByte(int offset);

/**
 * Returns amount of free ram, free set to start of free ram
 */
size_t os_MemChk(void **free);

/**
 * Throws an OS error
 */
void os_ThrowError(uint8_t error);

/**
 * Returns a pointer to the system stats
 */
void *os_GetSystemStats(void);

/**
 * Sets up the defualt error handlers if an OS routine encounters an error when running
 */
void os_PushErrorHandler(void *routine);
void os_PopErrorHandler(void);

/**
 * Returns a pointer to symtable of the OS
 */
void *os_GetSymTablePtr(void);

/**
 * Creates an appvar; and returns a pointer to the structure 
 * Returns NULL if creation failed for some reason, otherwise a pointer to the size bytes
 */
var_t *os_CreateAppVar(const char *name, uint16_t size);

/**
 * Returns next entry or NULL if no more entries, pass os_GetSymTablePtr() as first entry
 */
void *os_NextSymEntry(void *entry, uint24_t *type, uint24_t *nameLength, const char *name, void **data);

/**
 * If file exists, returns 1 and sets entry and data, otherwise returns 0.
 * entry and/or data can be NULL if you don't care
 */
int os_ChkFindSym(uint8_t type, const char *name, void **entry, void **data);

/**
 * type is set to the current varaible type in ANS, and a pointer to the data is returned
 * Returns NULL if Ans doesn't exist or type is NULL
 */
void *os_RclAns(uint8_t *type);

/**
 * Copies a real_t
 */
real_t os_RealCopy(const real_t *src);

/**
 * Unary operations used to interact with the OS math functions
 */
real_t os_RealAcosRad(const real_t *arg);
real_t os_RealAsinRad(const real_t *arg);
real_t os_RealAtanRad(const real_t *arg);
real_t os_RealCosRad(const real_t *arg);
real_t os_RealRadToDeg(const real_t *arg);
real_t os_RealExp(const real_t *arg);
real_t os_RealFloor(const real_t *arg);
real_t os_RealFrac(const real_t *arg);
real_t os_RealRoundInt(const real_t *arg);
real_t os_RealLog(const real_t *arg);
real_t os_RealNeg(const real_t *arg);
real_t os_RealDegToRad(const real_t *arg);
real_t os_RealInv(const real_t *arg);
real_t os_RealSinRad(const real_t *arg);
real_t os_RealSqrt(const real_t *arg);
real_t os_RealTanRad(const real_t *arg);
real_t os_RealInt(const real_t *arg);
cplx_t os_CplxSquare(const cplx_t *arg);

/**
 * Binary operations used to interact with the OS math functions
 */
real_t os_RealAdd(const real_t *arg1, const real_t *arg2);
real_t os_RealDiv(const real_t *arg1, const real_t *arg2);
real_t os_RealGcd(const real_t *arg1, const real_t *arg2);
real_t os_RealLcm(const real_t *arg1, const real_t *arg2);
real_t os_RealMax(const real_t *arg1, const real_t *arg2);
real_t os_RealMin(const real_t *arg1, const real_t *arg2);
real_t os_RealMul(const real_t *arg1, const real_t *arg2);
real_t os_RealNcr(const real_t *total, const real_t *num);
real_t os_RealNpr(const real_t *total, const real_t *num);
real_t os_RealPow(const real_t *base, const real_t *exp);
real_t os_RealRandInt(const real_t *min, const real_t *max);
real_t os_RealMod(const real_t *arg1, const real_t *arg2);
real_t os_RealSub(const real_t *arg1, const real_t *arg2);
/**
 * digits must be in the range 0 - 9
 */
real_t os_RealRound(const real_t *arg, char digits);

/**
 * Returns -1, 0, or 1 depending on the comparison
 */
int os_RealCompare(const real_t *arg1, const real_t *arg2);

/**
 * Conversion routines for ti-floats.
 * All saturate on overflow.
 */
int24_t os_RealToInt24(const real_t *arg);
real_t os_Int24ToReal(int24_t arg);
float os_RealToFloat(const real_t *arg);
real_t os_FloatToReal(float arg);

/** os_RealToStr:
  *  This converts a ti-float to a ti-ascii string.
  *  result: zero terminated string copied to this address
  *  arg: real to convert
  * maxLength: 
  *  <=0: use default max length (14)
  *  >0:  max length of result, minimum of 6
  * mode:
  *  0: Use current mode for everything (digits ignored)
  *  1: Normal mode
  *  2: Sci mode
  *  3: Eng mode
  *  >4: Use current Normal/Sci/Eng mode (digits still used)
  * digits:
  *  -1:  Float mode
  *  0-9: Fix # mode
  *  returns length of result
  */
int os_RealToStr(char *result, const real_t *arg, char maxLength, char mode, char digits);

/** os_StrToReal:
  *  This converts a ti-ascii string to a ti-float.
  *  String format regexp: / *[-\032+]?[0-9]*(\.[0-9]*)?([eE\033][-\032+]?[0-9]*)?/
  *  result: resulting ti-float stored here, on exponent overflow this is +-9.9999999999999e99
  *  string: ti-ascii string to convert
  *  end: if non-null, pointer to end of parsed number is stored here
  *  returns result
  */
real_t os_StrToReal(const char *string, char **end);

/**
 * High 8 is unsigned offset, low 8 is bits to test
 * os_TestFlagBits will return a 0 or 1
 */
int os_TestFlagBits(uint16_t offset_pattern);
void os_SetFlagBits(int16_t offset_pattern);
void os_ResetFlagBits(int16_t offset_pattern);

/**
 * Returns extended key in high byte
 */
uint16_t os_GetKey(void);

/**
 * Performs an OS call to get the keypad scan code
 * Technically return type is uint24_t, but that is not useful as the high byte is 0
 * Values returned are listed below
 */
uint8_t os_GetCSC(void);
typedef uint8_t sk_key_t;

/**
 * Things you shouldn't use unless you know what you are doing
 */
void os_ForceCmdNoChar(void);
void boot_Set6MHzMode(void);
void boot_Set48MHzMode(void);
void boot_Set6MHzModeI(void);
void boot_Set48MHzModeI(void);

/**
 * Use this function to call assembly functions in the OS and Bootcode
 * i.e. _OS( asm_HomeUp );
 */
void _OS(void (*function)(void));

/**
 * Assembly functions ( Don't forget to call from _OS() )
 */
void asm_MoveUp(void);
void asm_MoveDown(void);
void asm_HomeUp(void);
void asm_RunIndicOn(void);
void asm_RunIndicOff(void);
void asm_DisableAPD(void);
void asm_EnableAPD(void);
void asm_ArcChk(void);

/**
 * OS RAM Location defines for direct modification
 */
#define OS_BLUE_COLOR       10
#define OS_RED_COLOR        11
#define OS_BLACK_COLOR      12
#define OS_MAGENTA_COLOR    13
#define OS_GREEN_COLOR      14
#define OS_ORANGE_COLOR     15
#define OS_BROWN_COLOR      16
#define OS_NAVY_COLOR       17
#define OS_LTBLUE_COLOR     18
#define OS_YELLOW_COLOR     19
#define OS_WHITE_COLOR      20
#define OS_LTGRAY_COLOR     21
#define OS_MEDGRAY_COLOR    22
#define OS_GRAY_COLOR       23
#define OS_DARKGRAY_COLOR   24

#define os_ramStart          ((uint8_t*)0xD00000)
#define os_flags             ((uint8_t*)0xD00080)
#define os_textFlags         (*(uint8_t*)0xD00080)
#define os_apdFlags          (*(uint8_t*)0xD00088)
#define os_rclFlags          (*(uint8_t*)0xD0008E)
 
#define os_kbdScanCode       (*(uint8_t*)0xD00587)
#define os_kbdLGSC           (*(uint8_t*)0xD00588)
#define os_kbdPSC            (*(uint8_t*)0xD00589)
#define os_kbdWUR            (*(uint8_t*)0xD0058A)
#define os_kbdDebncCnt       (*(uint8_t*)0xD0058B)
#define os_kbdKey	     (*(uint8_t*)0xD0058C)
#define os_kbdGetKy          (*(uint8_t*)0xD0058D)
#define os_keyExtend         (*(uint8_t*)0xD0058E)
#define os_brightness        (*(uint8_t*)0xD0058F)
#define os_apdSubTimer       (*(uint8_t*)0xD00590)
#define os_apdTimer          (*(uint8_t*)0xD00591)
#define os_curRow            (*(uint8_t*)0xD00595)
#define os_curCol            (*(uint8_t*)0xD00596)

#define os_OP1               ((uint8_t*)0xD005F8)
#define os_OP2               ((uint8_t*)0xD00603)
#define os_OP3               ((uint8_t*)0xD0060E)
#define os_OP4               ((uint8_t*)0xD00619)
#define os_OP5               ((uint8_t*)0xD00624)
#define os_OP6               ((uint8_t*)0xD0062F)

#define os_progToEdit        ((char*)0xD0065B)
#define os_nameBuff          ((char*)0xD00663)

#define os_promptRow         (*(uint8_t*)0xD00800)
#define os_promptCol         (*(uint8_t*)0xD00801)
#define os_promptIns         (*(uint8_t*)0xD00802)
#define os_promptShift       (*(uint8_t*)0xD00803)
#define os_promptRet         (*(uint8_t*)0xD00804)
#define os_promptValid       (*(uint8_t*)0xD00807)

#define os_penCol            (*(uint24_t*)0xD008D2)
#define os_penRow            (*(uint8_t*)0xD008D5)

#define os_asmPrgmSize       (*(uint16_t*)0xD0118C) 

#define os_y1LineType        (*(uint8_t*)0xD024BF)
#define os_y2LineType        (*(uint8_t*)0xD024C0)
#define os_y3LineType        (*(uint8_t*)0xD024C1)
#define os_y4LineType        (*(uint8_t*)0xD024C2)
#define os_y5LineType        (*(uint8_t*)0xD024C3)
#define os_y6LineType        (*(uint8_t*)0xD024C4)
#define os_y7LineType        (*(uint8_t*)0xD024C5)
#define os_y8LineType        (*(uint8_t*)0xD024C6)
#define os_y9LineType        (*(uint8_t*)0xD024C7)
#define os_y0LineType        (*(uint8_t*)0xD024C8)
#define os_para1LineType     (*(uint8_t*)0xD024C9)
#define os_para2LineType     (*(uint8_t*)0xD024CA)
#define os_para3LineType     (*(uint8_t*)0xD024CB)
#define os_para4LineType     (*(uint8_t*)0xD024CC)
#define os_para5LineType     (*(uint8_t*)0xD024CD)
#define os_para6LineType     (*(uint8_t*)0xD024CE)
#define os_polar1LineType    (*(uint8_t*)0xD024CF)
#define os_polar2LineType    (*(uint8_t*)0xD024D0)
#define os_polar3LineType    (*(uint8_t*)0xD024D1)
#define os_polar4LineType    (*(uint8_t*)0xD024D2)
#define os_polar5LineType    (*(uint8_t*)0xD024D3)
#define os_polar6LineType    (*(uint8_t*)0xD024D4)
#define os_secULineType      (*(uint8_t*)0xD024D5)
#define os_secVLineType      (*(uint8_t*)0xD024D6)
#define os_secWLineType      (*(uint8_t*)0xD024D7)
#define os_y1LineColor       (*(uint8_t*)0xD024D8)
#define os_y2LineColor       (*(uint8_t*)0xD024D9)
#define os_y3LineColor       (*(uint8_t*)0xD024DA)
#define os_y4LineColor       (*(uint8_t*)0xD024DB)
#define os_y5LineColor       (*(uint8_t*)0xD024DC)
#define os_y6LineColor       (*(uint8_t*)0xD024DD)
#define os_y7LineColor       (*(uint8_t*)0xD024DE)
#define os_y8LineColor       (*(uint8_t*)0xD024DF)
#define os_y9LineColor       (*(uint8_t*)0xD024E0)
#define os_y0LineColor       (*(uint8_t*)0xD024E1)
#define os_para1LineColor    (*(uint8_t*)0xD024E2)
#define os_para2LineColor    (*(uint8_t*)0xD024E3)
#define os_para3LineColor    (*(uint8_t*)0xD024E4)
#define os_para4LineColor    (*(uint8_t*)0xD024E5)
#define os_para5LineColor    (*(uint8_t*)0xD024E6)
#define os_para6LineColor    (*(uint8_t*)0xD024E7)
#define os_polar1LineColor   (*(uint8_t*)0xD024E8)
#define os_polar2LineColor   (*(uint8_t*)0xD024E9)
#define os_polar3LineColor   (*(uint8_t*)0xD024EA)
#define os_polar4LineColor   (*(uint8_t*)0xD024EB)
#define os_polar5LineColor   (*(uint8_t*)0xD024EC)
#define os_polar6LineColor   (*(uint8_t*)0xD024ED)
#define os_secULineColor     (*(uint8_t*)0xD024EE)
#define os_secVLineColor     (*(uint8_t*)0xD024EF)
#define os_secWLineColor     (*(uint8_t*)0xD024F0)

#define os_appErr1           ((char*)0xD025A9)
#define os_appErr2           ((char*)0xD025B6)

#define os_cursorHookPtr     (*(uint24_t*)0xD025D5)
#define os_libraryHookPtr    (*(uint24_t*)0xD025D8)
#define os_rawKeyHookPtr     (*(uint24_t*)0xD025DB)
#define os_getKeyHookPtr     (*(uint24_t*)0xD025DE)
#define os_homescreenHookPtr (*(uint24_t*)0xD025E1)
#define os_windowHookPtr     (*(uint24_t*)0xD025E4)
#define os_graphHookPtr      (*(uint24_t*)0xD025E7)
#define os_yEqualsHookPtr    (*(uint24_t*)0xD025EA)
#define os_fontHookPtr       (*(uint24_t*)0xD025ED)
#define os_regraphHookPtr    (*(uint24_t*)0xD025F0)
#define os_graphicsHookPtr   (*(uint24_t*)0xD025F3)
#define os_traceHookPtr      (*(uint24_t*)0xD025F6)
#define os_parserHookPtr     (*(uint24_t*)0xD025F9)
#define os_appChangeHookPtr  (*(uint24_t*)0xD025FC)
#define os_catalog1HookPtr   (*(uint24_t*)0xD025FF)
#define os_helpHookPtr       (*(uint24_t*)0xD02602)
#define os_cxRedispHookPtr   (*(uint24_t*)0xD02605)
#define os_menuHookPtr       (*(uint24_t*)0xD02608)
#define os_catalog2HookPtr   (*(uint24_t*)0xD0260B)
#define os_tokenHookPtr      (*(uint24_t*)0xD0260E)
#define os_localizeHookPtr   (*(uint24_t*)0xD02611)
#define os_silentLinkHookPtr (*(uint24_t*)0xD02614)
#define os_USBActiveHookPtr  (*(uint24_t*)0xD0261A)

#define os_tempFreeArc       (*(uint24_t*)0xD02655) /* Set after asm_ArcChk call */

#define os_textBGcolor       (*(uint16_t*)0xD02688)
#define os_textFGcolor       (*(uint16_t*)0xD0268A)

#define os_drawBGColor       (*(uint16_t*)0xD026AA)
#define os_drawFGColor       (*(uint16_t*)0xD026AC)
#define os_drawColorCode     (*(uint8_t*)0xD026AE)

#define os_batteryStatus     (*(uint8_t*)0xD02A86)

#define os_graphBGColor      ((uint16_t*)0xD02A98)

#define os_fillRectColor     (*(uint16_t*)0xD02AC0)
#define os_statusBarBGColor  ((uint16_t*)0xD02ACC)

/**
 * ---- TI-OS Token definitions ----
 */
#define tToDMS		0x01
#define tToDEC		0x02
#define tToAbc		0x03
#define tStore		0x04	// ->
#define tBoxPlot	0x05
#define tLBrack		0x06	// '['
#define tRBrack		0x07	// ']'
#define tLBrace		0x08	// '{'
#define tRBrace		0x09	// '}'
#define tFromRad	0x0A
#define tFromDeg	0x0B
#define tRecip		0x0C
#define tSqr		0x0D
#define tTrnspos	0x0E
#define tCube		0x0F	// '^3'
#define tLParen		0x10	// '('
#define tRParen		0x11	// ')'
#define tRound		0x12	// 'round'
#define tPxTst		0x13	// 'PXL-TEST'
#define tAug		0x14	// 'aug'
#define tRowSwap	0x15	// 'rSwap'
#define tRowPlu		0x16	// 'rAdd'
#define tmRow		0x17	// 'multR'
#define tmRowPlus	0x18	// 'mRAdd'
#define tMax		0x19	// 'max'
#define tMin		0x1A	// 'min'
#define tRToPr		0x1B	// 'R>Pr'
#define tRToPo		0x1C	// 'R>Po'
#define tPToRx		0x1D	// 'P>Rx'
#define tPToRy		0x1E	// 'P>Ry'
#define tMedian		0x1F	// 'MEDIAN'
#define tRandM		0x20	// 'randM'
#define tMean		0x21	// 'MEAN'
#define tRoot		0x22	// 'ROOT'
#define tSeries		0x23	// 'seq'
#define tFnInt		0x24	// 'fnInt'
#define tNDeriv		0x25	// 'fnIr'
#define tEvalF		0x26
#define tFmin		0x27
#define tFmax		0x28
#define tSpace		0x29	// ' '
#define tString		0x2A	// '"'
#define tComma		0x2B	// ','
#define tii		0x2C	// 'i'
#define tFact		0x2D	// '!'
#define tCubicR		0x2E
#define tQuartR		0x2F
#define t0		0x30
#define t1		0x31
#define t2		0x32
#define t3		0x33
#define t4		0x34
#define t5		0x35
#define t6		0x36
#define t7		0x37
#define t8		0x38
#define t9		0x39
#define tDecPt		0x3A	// '.'
#define tee		0x3B	// 'e'
#define tOr		0x3C	// '_or_'
#define tXor		0x3D
#define tColon		0x3E	// ':'
#define tEnter		0x3F
#define tAnd		0x40	// '_and_'
#define tA		0x41
#define tB		0x42
#define tC		0x43
#define tD		0x44
#define tE		0x45
#define tF		0x46
#define tG		0x47
#define tH		0x48
#define tI		0x49
#define tJ		0x4A
#define tK		0x4B
#define tL		0x4C
#define tM		0x4D
#define tN		0x4E
#define tO		0x4F
#define tP		0x50
#define tQ		0x51
#define tR		0x52
#define tS		0x53
#define tT		0x54
#define tU		0x55
#define tV		0x56
#define tW		0x57
#define tX		0x58
#define tY		0x59
#define tZ		0x5A
#define tTheta		0x5B

/**
 * Extended Tokens
 */
#define tExtTok		0xEF
#define tSetDate	0x00
#define tSetTime	0x01
#define tCheckTmr	0x02
#define tSetDtFmt	0x03
#define tSetTmFmt	0x04
#define tTimeCnv	0x05
#define tDayOfWk	0x06
#define tGetDtStr	0x07
#define tGetTmStr	0x08
#define tGetDate	0x09
#define tGetTime	0x0A
#define tStartTmr	0x0B
#define tGtDtFmt	0x0C
#define tGetTmFmt	0x0D
#define tIsClockOn	0x0E
#define tClockOff	0x0F
#define tClockOn	0x10
#define tOpenLib	0x11
#define tExecLib	0x12
#define tInvT		0x13
#define tChiSquaredTest	0x14
#define tLinRegTInt	0x15
#define tManualFit	0x16
#define tZQuadrant	0x17
#define tZFracHalf	0x18
#define tZFracThird	0x19
#define tZFracFourth	0x1A
#define tZFracFifth	0x1B
#define tZFracEighth	0x1C
#define tZFracTenth	0x1D
#define tFracSlash	0x2E
#define tFracMixedNum	0x2F
#define tSwapImProper	0x30
#define tSwapFracDec	0x31
#define tRemainder	0x32
#define tSummationSigma	0x33
#define tLogBase	0x34
#define tRandIntNoRep	0x35
#define tMathPrint	0x36
#define tClassic	0x38
#define tAutoAnswer	0x3B
#define tDecAnswer	0x3C
#define tFracAnswer	0x3D
#define tBlue		0x41
#define tRed		0x42
#define tBlack		0x43
#define tMagenta	0x44
#define tGreen		0x45
#define tOrange		0x46
#define tBrown		0x47
#define tNavy		0x48
#define tLtBlue		0x49
#define tYellow		0x4A
#define tWhite		0x4B
#define tLtGray		0x4C
#define tMedGray	0x4D
#define tGray		0x4E
#define tDarkGray	0x4F
#define tGraphColor	0x65
#define tTextColor	0x67
#define tBackgroundOn	0x5B
#define tBackgroundOff	0x64
#define tThin		0x74
#define tBorderColor	0x6C
#define tAsm84CPrgm	0x68
#define tAsm84CCmp	0x69
#define tAsm84CeCmp	0x7B
#define tAsm84CePrgm	0x7A

#define tVarMat		0x5C
#define tVarLst		0x5D
#define tVarEqu		0x5E
#define tProg		0x5F
#define tVarPict	0x60
#define tVarGDB		0x61
#define tVarOut		0x62
#define tVarSys		0x63

/**
 * Mode settings tokens
 */
#define tRad		0x64	// 'Radian'
#define tDeg		0x65	// 'Degree'
#define tNormF		0x66	// 'Normal'
#define tSci		0x67	// 'Sci'
#define tEng		0x68	// 'Eng'
#define tFloat		0x69	// 'Float'
#define tFix		0x73	// 'Fix_'
#define tSplitOn	0x74
#define tFullScreen	0x75
#define tStndrd		0x76	// 'Func'
#define tParam		0x77	// 'Param'
#define tPolar		0x78	// 'Pol'
#define tSeqG		0x79	// ;79h
#define tAFillOn	0x7A	// 'AUTO FILL ON'
#define tAFillOff	0x7B	// 'AutoFill OFF'
#define tACalcOn	0x7C
#define tACalcOff	0x7D

#define tEQ		0x6A	// '=='
#define tLT		0x6B	// '<'
#define tGT		0x6C	// '>'
#define tLE		0x6D	// LLE
#define tGE		0x6E	// LGE
#define tNE		0x6F	// LNE
#define tAdd		0x70	// '+'
#define tSub		0x71	// '-'
#define tMul		0x82	// '*'
#define tDiv		0x83	// '/'
#define tAns		0x72

#define tBoxIcon	0x7F
#define tCrossIcon	0x80
#define tDotIcon	0x81

#define tTrace		0x84	// 'Trace'
#define tClDrw		0x85	// 'ClDraw'
#define tZoomStd	0x86	// 'ZStd'
#define tZoomtrg	0x87	// 'Ztrg'
#define tZoomBox	0x88	// 'ZBOX'
#define tZoomIn		0x89	// 'ZIn'
#define tZoomOut	0x8A	// 'ZOut'
#define tZoomSqr	0x8B	// 'ZSqr'
#define tZoomInt	0x8C	// 'ZInt'
#define tZoomPrev	0x8D	// 'ZPrev'
#define tZoomDec	0x8E	// 'ZDecm'
#define tZoomStat	0x8F	// 'ZStat
#define tUsrZm		0x90	// 'ZRcl'
#define tPrtScrn	0x91	// 'PrtScrn'
#define tZoomSto	0x92	//  'ZSto'
#define tText		0x93

#define tnPr		0x94	// '_nPr_'
#define tnCr		0x95	// '_nCr_'

// Graph Commands
#define tYOn		0x96	// 'FnOn_'
#define tYOff		0x97	// 'FnOff_'
#define tStPic		0x98	// 'StPic_'
#define tRcPic		0x99	// 'RcPic_'
#define tStoDB		0x9A	// 'StGDB_'
#define tRclDB		0x9B	// 'RcGDB_'
#define tLine		0x9C	// 'Line'
#define tVert		0x9D	// 'Vert_'
#define tPtOn		0x9E	// 'PtOn'
#define tPtOff		0x9F	// 'PtOff'
#define tPtChg		0xA0	// 'PtChg'
#define tPXOn		0xA1
#define tPXOff		0xA2
#define tPXChg		0xA3
#define tShade		0xA4	// 'Shade'
#define tCircle		0xA5	// 'Circle'
#define tHorz		0xA6	// 'HORIZONTAL'
#define tTanLn		0xA7	// 'TanLn'
#define tDrInv		0xA8	// 'DrInv_'
#define tDrawF		0xA9	// 'DrawF_'
#define tVarStrng	0xAA

// Functions with No Argument
#define tRand		0xAB	// 'rand'
#define tPi		0xAC	//  Lpi
#define tGetKey		0xAD	// 'getKy'
#define tAPost		0xAE	// '''
#define tQuest		0xAF	// '?'
#define tChs		0xB0
#define tInt		0xB1
#define tAbs		0xB2
#define tDet		0xB3
#define tIdent		0xB4
#define tDim		0xB5
#define tSum		0xB6
#define tProd		0xB7
#define tNot		0xB8
#define tIPart		0xB9
#define tFPart		0xBA

// New 2 Byte Tokens
#define t2ByteTok	0xBB
#define tSqrt		0xBC
#define tCubRt		0xBD
#define tLn		0xBE
#define tExp		0xBF
#define tLog		0xC0
#define tALog		0xC1
#define tSin		0xC2
#define tASin		0xC3
#define tCos		0xC4
#define tACos		0xC5
#define tTan		0xC6
#define tATan		0xC7
#define tSinH		0xC8
#define tASinH		0xC9
#define tCoshH		0xCA
#define tACosH		0xCB
#define tTanH		0xCC
#define tATanH		0xCD

// Some Programming Commands
#define tIf		0xCE	// 'If_'
#define tThen		0xCF	// 'Then_'
#define tElse		0xD0	// 'Else_'
#define tWhile		0xD1	// 'While_'
#define tRepeat		0xD2	// 'Repeat_'
#define tFor		0xD3	// 'For_'
#define tEnd		0xD4	// 'End'
#define tReturn		0xD5	// 'Return'
#define tLbl		0xD6	// 'Lbl_'
#define tGoto		0xD7	// 'Goto_'
#define tPause		0xD8	// 'Pause_'
#define tStop		0xD9	// 'Stop'
#define tISG		0xDA	// 'IS>'
#define tDSL		0xDB	// 'DS<'
#define tInput		0xDC	// 'Input_'
#define tPrompt		0xDD	// 'Prompt_'
#define tDisp		0xDE	// 'Disp_'
#define tDispG		0xDF	// 'DispG'
#define tOutput		0xE0	// 'Outpt'
#define tClLCD		0xE1	// 'ClLCD'
#define tConst		0xE2	// 'Fill'
#define tSortA		0xE3	// 'sortA_'
#define tSortD		0xE4	// 'sortD_'
#define tDispTab	0xE5	// 'Disp Table
#define tMenu		0xE6	// 'Menu'
#define tSendMBL	0xE7	// 'Send'
#define tGetMBL		0xE8	// 'Get'

// Stat Plot Commands
#define tPlotOn		0xE9	// 'PLOTSON'
#define tPlotOff	0xEA	// 'PLOTSOFF
#define tListName	0xEB	// List Designator
#define tPlot1		0xEC
#define tPlot2		0xED
#define tPlot3		0xEE
#define tUnused01	0xEF	// available?
#define tPower		0xF0	// '^'
#define tXRoot		0xF1	// LsupX,Lroot
#define tOneVar		0xF2	// 'OneVar_'
#define tTwoVar		0xF3
#define tLR		0xF4	// 'LinR(A+BX)'
#define tLRExp		0xF5	// 'ExpR_'
#define tLRLn		0xF6	// 'LnR_'
#define tLRPwr		0xF7	// 'PwrR_'
#define tMedMed		0xF8
#define tQuad		0xF9
#define tClrLst		0xFA	// 'Clear List'
#define tClrTbl		0xFB	// 'Clear Table'
#define tHist		0xFC	// 'Hist_'
#define txyLine		0xFD	// 'xyline_'
#define tScatter	0xFE	// 'Scatter_'
#define tLR1		0xFF	// 'LINR(AX+B)'

// 2nd Half Of Graph Format Tokens
#define tSeq		0x00	// 'SeqG'
#define tSimulG		0x01	// 'SimulG'
#define tPolarG		0x02	// 'PolarGC'
#define tRectG		0x03	// 'RectGC'
#define tCoordOn	0x04	// 'CoordOn'
#define tCoordOff	0x05	// 'CoordOff'
#define tDrawLine	0x06	// 'DrawLine'
#define tDrawDot	0x07	// 'DrawDot'
#define tAxisOn		0x08	// 'AxesOn'
#define tAxisOff	0x09	// 'AxesOff'
#define tGridOn		0x0A	// 'GridOn'
#define tGridOff	0x0B	// 'GridOff'
#define tLblOn		0x0C	// 'LabelOn'
#define tLblOff		0x0D	// 'LabelOff'
#define tWebOn		0x0E	// 'WebOn'
#define tWebOff		0x0F	// 'WebOFF'
#define tuv		0x10	// U vs V
#define tvw		0x11	// V vs W
#define tuw		0x12	// U vs W

// 2nd Half Of User Matrix Tokens
#define tMatA		0x00	// MAT A
#define tMatB		0x01	// MAT B
#define tMatC		0x02	// MAT C
#define tMatD		0x03	// MAT D
#define tMatE		0x04	// MAT E
#define tMatF		0x05	// MAT F
#define tMatG		0x06	// MAT G
#define tMatH		0x07	// MAT H
#define tMatI		0x08	// MAT I
#define tMatJ		0x09	// MAT J

// 2nd Half Of User List Tokens
#define tL1		0x00	// LIST 1
#define tL2		0x01	// LIST 2
#define tL3		0x02	// LIST 3
#define tL4		0x03	// LIST 4
#define tL5		0x04	// LIST 5
#define tL6		0x05	// LIST 6

// 2nd Half Of User Equation Tokens
// Y Equations have bit 4 set
#define tY1		0x10	// Y1
#define tY2		0x11	// Y2
#define tY3		0x12	// Y3
#define tY4		0x13	// Y4
#define tY5		0x14	// Y5
#define tY6		0x15	// Y6
#define tY7		0x16	// Y7
#define tY8		0x17	// Y8
#define tY9		0x18	// Y9
#define tY0		0x19	// Y0

// Param Equations Have Bit 5 Set
#define tX1T		0x20	// X1t
#define tY1T		0x21	// Y1t
#define tX2T		0x22	// X2t
#define tY2T		0x23	// Y2t
#define tX3T		0x24	// X3t
#define tY3T		0x25	// Y3t
#define tX4T		0x26	// X4t
#define tY4T		0x27	// Y4t
#define tX5T		0x28	// X5t
#define tY5T		0x29	// Y5t
#define tX6T		0x2A	// X6t
#define tY6T		0x2B	// Y6t

// Polar Equations Have Bit 6 Set
#define tR1		0x40	// R1
#define tR2		0x41	// R2
#define tR3		0x42	// R3
#define tR4		0x43	// R4
#define tR5		0x44	// R5
#define tR6		0x45	// R6

// Recursion Equations Have Bit 7 Set
#define tun		0x80	// Un
#define tvn		0x81	// Vn
#define twn		0x82	// Wn

// 2nd Half User Picture Tokens
#define tPic1		0x00	// PIC1
#define tPic2		0x01	// PIC2
#define tPic3		0x02	// PIC3
#define tPic4		0x03	// PIC4
#define tPic5		0x04	// PIC5
#define tPic6		0x05	// PIC6
#define tPic7		0x06	// PIC7
#define tPic8		0x07	// PIC8
#define tPic9		0x08	// PIC9
#define tPic0		0x09	// PIC0

// 2nd Half User Graph Database Tokens
#define tGDB1		0x00	// GDB1
#define tGDB2		0x01	// GDB2
#define tGDB3		0x02	// GDB3
#define tGDB4		0x03	// GDB4
#define tGDB5		0x04	// GDB5
#define tGDB6		0x05	// GDB6
#define tGDB7		0x06	// GDB7
#define tGDB8		0x07	// GDB8
#define tGDB9		0x08	// GDB9
#define tGDB0		0x09	// GDB0

// 2nd Half Of String Vars
#define tStr1		0x00
#define tStr2		0x01
#define tStr3		0x02
#define tStr4		0x03
#define tStr5		0x04
#define tStr6		0x05
#define tStr7		0x06
#define tStr8		0x07
#define tStr9		0x08
#define tStr0		0x09

// 2nd Half Of System Output Only Variables
#define tRegEq		0x01	// REGRESSION EQUATION
#define tStatN		0x02	// STATISTICS N
#define tXMean		0x03	// X MEAN
#define tSumX		0x04	// SUM(X)
#define tSumXSqr	0x05	// SUM(X^2)
#define tStdX		0x06	// STANDARD DEV X
#define tStdPX		0x07	// STANDARD DEV POP X
#define tMinX		0x08	// Min X VALUE
#define tMaxX		0x09	// Max X VALUE
#define tMinY		0x0A	// Min Y VALUE
#define tMaxY		0x0B	// Max Y VALUE
#define tYmean		0x0C	// Y MEAN
#define tSumY		0x0D	// SUM(Y)
#define tSumYSqr	0x0E	// SUM(Y^2)
#define tStdY		0x0F	// STANDARD DEV Y
#define tStdPY		0x10	// STANDARD DEV POP Y
#define tSumXY		0x11	// SUM(XY)
#define tCorr		0x12	// CORRELATION
#define tMedX		0x13	// MED(X)
#define tQ1		0x14	// 1ST QUADRANT OF X
#define tQ3		0x15	// 3RD QUADRANT OF X
#define tQuadA		0x16	// 1ST TERM OF QUAD POLY REG/ Y-INT
#define tQuadB		0x17	// 2ND TERM OF QUAD POLY REG/ SLOPE
#define tQuadC		0x18	// 3RD TERM OF QUAD POLY REG
#define tCubeD		0x19	// 4TH TERM OF CUBIC POLY REG
#define tQuartE		0x1A	// 5TH TERM OF QUART POLY REG
#define tMedX1		0x1B	// x1 FOR MED-MED
#define tMedX2		0x1C	// x2 FOR MED-MED
#define tMedX3		0x1D	// x3 FOR MED-MED
#define tMedY1		0x1E	// y1 FOR MED-MED
#define tMedY2		0x1F	// y2 FOR MED-MED
#define tMedY3		0x20	// y3 FOR MED-MED
#define tRecurn		0x21	// RECURSION N
#define tStatP		0x22
#define tStatZ		0x23
#define tStatT		0x24
#define tStatChi	0x25
#define tStatF		0x26
#define tStatDF		0x27
#define tStatPhat	0x28
#define tStatPhat1	0x29
#define tStatPhat2	0x2A
#define tStatMeanX1	0x2B
#define tStatStdX1	0x2C
#define tStatN1		0x2D
#define tStatMeanX2	0x2E
#define tStatStdX2	0x2F
#define tStatN2		0x30
#define tStatStdXP	0x31
#define tStatLower	0x32
#define tStatUpper	0x33
#define tStat_s		0x34
#define tLRSqr		0x35	// r^2
#define tBRSqr		0x36	// R^2

// These next tokens are only used to access the data
// They are display only and the user cannot access them at all
#define tF_DF		0x37	// ANOFAV FACTOR DF
#define tF_SS		0x38	// ANOFAV FACTOR SS
#define tF_MS		0x39	// ANOFAV FACTOR MS
#define tE_DF		0x3A	// ANOFAV ERROR DF
#define tE_SS		0x3B	// ANOFAV ERROR SS
#define tE_MS		0x3C	// ANOFAV ERROR MS

// 2nd Half Of System Input/Output Variables
#define tuXscl		0x00
#define tuYscl		0x01
#define tXscl		0x02
#define tYscl		0x03
#define tRecuru0	0x04	// U 1st Initial condition
#define tRecurv0	0x05	// V 1st Initial condition
#define tun1		0x06	// U(N-1); not used
#define tvn1		0x07	// V(N-1); not used
#define tuRecuru0	0x08
#define tuRecurv0	0x09
#define tXmin		0x0A
#define tXmax		0x0B
#define tYmin		0x0C
#define tYmax		0x0D
#define tTmin		0x0E
#define tTmax		0x0F
#define tThetaMin	0x10
#define tThetaMax	0x11
#define tuXmin		0x12
#define tuXmax		0x13
#define tuYmin		0x14
#define tuYmax		0x15
#define tuThetMin	0x16
#define tuThetMax	0x17
#define tuTmin		0x18
#define tuTmax		0x19
#define tTblMin		0x1A
#define tPlotStart	0x1B
#define tuPlotStart	0x1C
#define tnMax		0x1D
#define tunMax		0x1E
#define tnMin		0x1F
#define tunMin		0x20
#define tTblStep	0x21
#define tTStep		0x22
#define tThetaStep	0x23
#define tuTStep		0x24
#define tuThetStep	0x25
#define tDeltaX		0x26
#define tDeltaY		0x27
#define tXFact		0x28
#define tYFact		0x29
#define tTblInput	0x2A
#define tFinN		0x2B
#define tFinI		0x2C
#define tFinPV		0x2D
#define tFinPMT		0x2E
#define tFinFV		0x2F
#define tFinPY		0x30
#define tFinCY		0x31
#define tRecurw0	0x32	// w0(1)
#define tuRecurw0	0x33
#define tPlotStep	0x34
#define tuPlotStep	0x35
#define tXres		0x36
#define tuXres		0x37
#define tRecuru02	0x38	// u0(2)
#define tuRecuru02	0x39
#define tRecurv02	0x3C	// v0(2)
#define tuRecurv02	0x3D
#define tRecurw02	0x3E	// w0(2)
#define tuRecurw02	0x3F

// 2nd Byte Of t2ByteTok Tokens
#define tFinNPV		0x00
#define tFinIRR		0x01
#define tFinBAL		0x02
#define tFinPRN		0x03
#define tFinINT		0x04
#define tFinToNom	0x05
#define tFinToEff	0x06
#define tFinDBD		0x07
#define tLCM		0x08
#define tGCD		0x09
#define tRandInt	0x0A
#define tRandBin	0x0B
#define tSubStrng	0x0C
#define tStdDev		0x0D
#define tVariance	0x0E
#define tInStrng	0x0F
#define tDNormal	0x10
#define tInvNorm	0x11
#define tDT		0x12
#define tChI		0x13
#define tDF		0x14
#define tBINPDF		0x15
#define tBINCDF		0x16
#define tPOIPDF		0x17
#define tPOICDF		0x18
#define tGEOPDF		0x19
#define tGEOCDF		0x1A
#define tNormalPDF	0x1B
#define tTPDF		0x1C
#define tChiPDF		0x1D
#define tFPDF		0x1E
#define tRandNorm	0x1F
#define tFinFPMT	0x20
#define tFinFI		0x21
#define tFinFPV		0x22
#define tFinFN		0x23
#define tFinFFV		0x24
#define tConj		0x25
#define tReal		0x26
#define tImag		0x27
#define tAngle		0x28
#define tCumSum		0x29
#define tExpr		0x2A
#define tLength		0x2B
#define tDeltaLst	0x2C
#define tRef		0x2D
#define tRRef		0x2E
#define tToRect		0x2F
#define tToPolar	0x30
#define tConste		0x31
#define tSinReg		0x32
#define tLogistic	0x33
#define tLinRegTTest	0x34
#define tShadeNorm	0x35
#define tShadeT		0x36
#define tShadeChi	0x37
#define tShadeF		0x38
#define tMatToLst	0x39
#define tLstToMat	0x3A
#define tZTest		0x3B
#define tTTest		0x3C
#define t2SampZTest	0x3D
#define t1PropZTest	0x3E
#define t2PropZTest	0x3F
#define tChiTest	0x40
#define tZIntVal	0x41
#define t2SampZInt	0x42
#define t1PropZInt	0x43
#define t2PropZInt	0x44
#define tGraphStyle	0x45
#define t2SampTTest	0x46
#define t2SampFTest	0x47
#define tTIntVal	0x48
#define t2SampTInt	0x49
#define tSetupLst	0x4A
#define tFinPMTend	0x4B
#define tFinPMTbeg	0x4C
#define tRealM		0x4D
#define tPolarM		0x4E
#define tRectM		0x4F
#define tExprOn		0x50
#define tExprOff	0x51
#define tClrAllLst	0x52
#define tGetCalc	0x53
#define tDelVar		0x54
#define tEquToStrng	0x55
#define tStrngToequ 	0x56
#define tDelLast	0x57
#define tSelect		0x58
#define tANOVA		0x59
#define tModBox		0x5A
#define tNormProb	0x5B
#define tMGT		0x64	// VERTICAL SPLIT
#define tZFit		0x65	// ZOOM FIT
#define tDiag_on	0x66	// DIANOSTIC DISPLAY ON
#define tDiag_off	0x67	// DIANOSTIC DISPLAY OFF
#define tArchive	0x68	// Archive
#define tUnarchive	0x69	// UnArchive
#define tAsm		0x6A
#define tAsmComp	0x6B	// asm compile
#define tAsmPrgm	0x6C	// Signifies a program is asm
#define tAsmCmp		0x6D	// asm program is compiled
#define tLcapAAcute	0x6E
#define tLcapAGrave	0x6F
#define tLcapACaret	0x70
#define tLcapADier	0x71
#define tLaAcute	0x72
#define tLaGrave	0x73
#define tLaCaret	0x74
#define tLaDier		0x75
#define tLcapEAcute	0x76
#define tLcapEGrave	0x77
#define tLcapECaret	0x78
#define tLcapEDier	0x79
#define tLeAcute	0x7A
#define tLeGrave	0x7B
#define tLeCaret	0x7C
#define tLeDier		0x7D
#define tLcapIGrave	0x7F
#define tLcapICaret	0x80
#define tLcapIDier	0x81
#define tLiAcute	0x82
#define tLiGrave	0x83
#define tLiCaret	0x84
#define tLiDier		0x85
#define tLcapOAcute	0x86
#define tLcapOGrave	0x87
#define tLcapOCaret	0x88
#define tLcapODier	0x89
#define tLoAcute	0x8A
#define tLoGrave	0x8B
#define tLoCaret	0x8C
#define tLoDier		0x8D
#define tLcapUAcute	0x8E
#define tLcapUGrave	0x8F
#define tLcapUCaret	0x90
#define tLcapUDier	0x91
#define tLuAcute	0x92
#define tLuGrave	0x93
#define tLuCaret	0x94
#define tLuDier		0x95
#define tLcapCCed	0x96
#define tLcCed		0x97
#define tLcapNTilde	0x98
#define tLnTilde	0x99
#define tLaccent	0x9A
#define tLgrave		0x9B
#define tLdieresis	0x9C
#define tLquesDown	0x9D
#define tLexclamDown	0x9E
#define tLalpha		0x9F
#define tLbeta		0xA0
#define tLgamma		0xA1
#define tLcapDelta	0xA2
#define tLdelta		0xA3
#define tLepsilon	0xA4
#define tLlambda	0xA5
#define tLmu		0xA6
#define tLpi		0xA7
#define tLrho		0xA8
#define tLcapSigma	0xA9
#define tLphi		0xAB
#define tLcapOmega	0xAC
#define tLphat		0xAD
#define tLchi		0xAE
#define tLstatF		0xAF
#define tLa		0xB0
#define tLb		0xB1
#define tLc		0xB2
#define tLd		0xB3
#define tLsmalle	0xB4
#define tLf		0xB5
#define tLsmallg	0xB6
#define tLh		0xB7
#define tLi		0xB8
#define tLj		0xB9
#define tLk		0xBA
#define tLl		0xBC
#define tLm		0xBD
#define tLsmalln	0xBE
#define tLo		0xBF
#define tLp		0xC0
#define tLq		0xC1
#define tLsmallr	0xC2
#define tLs		0xC3
#define tLsmallt	0xC4
#define tLu		0xC5
#define tLv		0xC6
#define tLw		0xC7
#define tLx		0xC8
#define tLy		0xC9
#define tLz		0xCA
#define tLsigma		0xCB
#define tLtau		0xCC
#define tLcapIAcute	0xCD
#define tGarbageCollect	0xCE

// 2 byte extended tokens (tExtTok) present in OS 5.2 and above
#define tSEQn		0x8F	// 'SEQ(n)'
#define tSEQn1		0x90	// 'SEQ(n+1)'
#define tSEQn2		0x91	// 'SEQ(n+2)'
#define tLEFT		0x92	// 'LEFT'
#define tCENTER		0x93	// 'CENTER'
#define tRIGHT		0x94	// 'RIGHT'
#define tInvBinom	0x95	// 'invBinom('
#define tWait		0x96	// 'Wait_'
#define tToString	0x97	// 'toString('
#define tEval		0x98	// 'eval('

/**
 * --- TIOS System error codes ---
 */
#define OS_E_EDIT           1<<7
#define OS_E_MASK           0x7F
#define OS_E_OVERFLOW       1+OS_E_EDIT
#define OS_E_DIVBY0         2+OS_E_EDIT
#define OS_E_SINGULARMAT    3+OS_E_EDIT
#define OS_E_DOMAIN         4+OS_E_EDIT
#define OS_E_INCREMENT      5+OS_E_EDIT
#define OS_E_BREAK          6+OS_E_EDIT
#define OS_E_NONREAL        7+OS_E_EDIT
#define OS_E_SYNTAX         8+OS_E_EDIT
#define OS_E_DATATYPE       9+OS_E_EDIT
#define OS_E_ARGUMENT       10+OS_E_EDIT
#define OS_E_DIMMISMATCH    11+OS_E_EDIT
#define OS_E_DIMENSION      12+OS_E_EDIT
#define OS_E_UNDEFINED      13+OS_E_EDIT
#define OS_E_MEMORY         14+OS_E_EDIT
#define OS_E_INVALID        15+OS_E_EDIT
#define OS_E_ILLEGALNEST    16+OS_E_EDIT
#define OS_E_BOUND          17+OS_E_EDIT
#define OS_E_GRAPHRANGE     18+OS_E_EDIT
#define OS_E_ZOOM           19+OS_E_EDIT
#define OS_E_LABEL          20
#define OS_E_STAT           21
#define OS_E_SOLVER         22+OS_E_EDIT
#define OS_E_SINGULARITY    23+OS_E_EDIT
#define OS_E_SIGNCHANGE     24+OS_E_EDIT
#define OS_E_ITERATIONS     25+OS_E_EDIT
#define OS_E_BADGUESS       26+OS_E_EDIT
#define OS_E_STATPLOT       27
#define OS_E_TOLTOOSMALL    28+OS_E_EDIT
#define OS_E_RESERVED       29+OS_E_EDIT
#define OS_E_MODE           30+OS_E_EDIT
#define OS_E_LNKERR         31+OS_E_EDIT
#define OS_E_LNKMEMERR      32+OS_E_EDIT
#define OS_E_LNKTRANSERR    33+OS_E_EDIT
#define OS_E_LNKDUPERR      34+OS_E_EDIT
#define OS_E_LNKMEMFULL     35+OS_E_EDIT
#define OS_E_UNKNOWN        36+OS_E_EDIT
#define OS_E_SCALE          37+OS_E_EDIT
#define OS_E_IDNOTFOUND     38
#define OS_E_NOMODE         39+OS_E_EDIT
#define OS_E_VALIDATION     40
#define OS_E_LENGTH         41+OS_E_EDIT
#define OS_E_APPLICATION    42+OS_E_EDIT
#define OS_E_APPERR1        43+OS_E_EDIT
#define OS_E_APPERR2        44+OS_E_EDIT
#define OS_E_EXPIREDAPP     45
#define OS_E_BADADD         46
#define OS_E_ARCHIVED       47+OS_E_EDIT
#define OS_E_VERSION        48
#define OS_E_ARCHFULL       49
#define OS_E_VARIABLE       50+OS_E_EDIT
#define OS_E_DUPLICATE      51+OS_E_EDIT

/**
 * --- TI-OS os_GetCSC Scan Code Return Values ---
 */
#define sk_Down             0x01
#define sk_Left             0x02
#define sk_Right            0x03
#define sk_Up               0x04
#define sk_Enter            0x09
#define sk_2nd              0x36
#define sk_Clear            0x0F
#define sk_Alpha            0x30
#define sk_Add              0x0A
#define sk_Sub              0x0B
#define sk_Mul              0x0C
#define sk_Div              0x0D
#define sk_Graph            0x31
#define sk_Trace            0x32
#define sk_Zoom             0x33
#define sk_Window           0x34
#define sk_Yequ             0x35
#define sk_Mode             0x37
#define sk_Del              0x38
#define sk_Store            0x2A
#define sk_Ln               0x2B
#define sk_Log              0x2C
#define sk_Square           0x2D
#define sk_Recip            0x2E
#define sk_Math             0x2F
#define sk_0                0x21
#define sk_1                0x22
#define sk_4                0x23
#define sk_7                0x24
#define sk_2                0x1A
#define sk_5                0x1B
#define sk_8                0x1C
#define sk_3                0x12
#define sk_6                0x13
#define sk_9                0x14
#define sk_Comma            0x25
#define sk_Sin              0x26
#define sk_Apps             0x27
#define sk_GraphVar         0x28
#define sk_DecPnt           0x19
#define sk_LParen           0x1D
#define sk_Cos              0x1E
#define sk_Prgm             0x1F
#define sk_Stat             0x20
#define sk_Chs              0x10
#define sk_RParen           0x15
#define sk_Tan              0x16
#define sk_Vars             0x17
#define sk_Power            0x0E

#endif