ti/flags.h

#include <ti/flags.h>

TI’s operating system has a lot of simple states it keeps track of, such as whether 2nd has been pressed. These settings are stored in a structure called the system flags, and can be accessed quickly by the OS. Most of these flags are useful only if you need to access OS mathematical or UI functions.

API Documentation

TI CE OS flags.

Authors

Matt “MateoConLechuga” Waltz

Jacob “jacobly” Young

Defines

OS_FLAG_ID(GROUP, MEMBER)

Converts a flag group name and member ID to a literal.

The flag_ prefix is automatically taken care of.

For example, OS_FLAG_ID(INDIC, ENABLE)

Parameters
  • GROUP[in] Flag group name without the OS_FLAG_ prefix

  • MEMBER[in] Flag item name without the OS_FLAG_GROUP_ prefix

os_SetFlag(GROUP, MEMBER)

Sets an OS flag to 1.

The OS_FLAGS_ prefix and group prefix are added automatically for you.

For example, instead of:

os_SetFlagByte(OS_FLAGS_INDIC, OS_FLAGS_INDIC_ENABLE);

you can do:

os_SetFlag(INDIC, ENABLE);

os_ResetFlag(GROUP, MEMBER)

Clears an OS flag to 0.

See also

os_SetFlag

os_TestFlag(GROUP, MEMBER)

Checks if an OS flag is set.

See also

os_SetFlag

OS_FLAGS_TRIG

GROUP: Trig-related.

OS_FLAGS_TRIG_DEGREES

Set for degrees, reset for radians.

OS_FLAGS_KBD

GROUP: Keyboard scan control.

OS_FLAGS_KBD_SCR

Scan Code Read.

OS_FLAGS_KBD_KEYPRESS

Set if a key press is in the key press buffer.

See also

os_KbdScanCode in <ti/getcsc.h>

OS_FLAGS_DONE

GROUP: “Done”.

OS_FLAGS_DONE_PRGM

Show “Done” after program exits.

OS_FLAGS_EDIT

GROUP: OS edit buffer.

OS_FLAGS_EDIT_OPEN

Set if an edit buffer is open.

OS_FLAGS_ANS

GROUP: Ans variable flags.

OS_FLAGS_ANS_SCROLL

Set if viewing Ans can scroll, must be reset to move cursor in edit buffer.

OS_FLAGS_MON

GROUP: System monitor.

You generally should not mess with the system monitor unless you’re writing a flash application that integrates with the OS. And we can’t sign flash applications.

OS_FLAGS_MON_ABANDON

Don’t start any long process in put away routine.

OS_FLAGS_PLOT

GROUP: Plot screen.

OS_FLAGS_PLOT_LOC

0=bkup and display, 1=display only.

By default, this memory is part of the C heap.

OS_FLAGS_PLOT_DISP

1=plot is in display, 0=text in display, this also indicates whether graph is being shown or not

OS_FLAGS_GRFMODE

GROUP: Graph mode.

OS_FLAGS_GRFMODE_FUNC

Standard function graph Y=f(x)

OS_FLAGS_GRFMODE_POLAR

Polar graph mode.

OS_FLAGS_GRFMODE_PARAM

Parametric graph mode.

OS_FLAGS_GRFMODE_RECUR

Sequence graph mode.

OS_FLAGS_GRAPH

GROUP: Graph screen.

OS_FLAGS_GRAPH_DRAW

Redraw graph screen.

On exit, this is automatically set by the C runtime.

OS_FLAGS_GRAPH_CURSOR
OS_FLAGS_GRF

GROUP: Graph screen format.

OS_FLAGS_GRF_DOT

Draw dots instead of connecting points.

OS_FLAGS_GRF_SIMUL

Draw all graphs simultaneously.

OS_FLAGS_GRF_GRID

Display grid.

OS_FLAGS_GRF_POLAR

Display polar coordinates.

OS_FLAGS_GRF_NOCOORD

Hide coordinates.

OS_FLAGS_GRF_NOAXIS

Hide X and Y axes.

OS_FLAGS_GRF_LABEL

Show axis labels.

OS_FLAGS_TEXT

GROUP: Text display.

OS_FLAGS_TEXT_ERASEBELOW

Erase line below small char.

OS_FLAGS_TEXT_SCROLLED

Screen has scrolled.

OS_FLAGS_TEXT_INVERSE

Text in inverse color.

OS_FLAGS_TEXT_INSMODE

Insert mode.

OS_FLAGS_PARSER

GROUP: Parser (for BASIC and equations).

No useful equates for C programs.

OS_FLAGS_PARSER2

GROUP: Parser.

OS_FLAGS_PARSER2_NUMOP1

Signals a result in OP1.

OS_FLAGS_NEWDISPF

GROUP: Derivative mode.

OS_FLAGS_NEWDISPF_PRECLRFORMODE

1=HELP BLINK ON MODE SCREEN

OS_FLAGS_NEWDISPF_ALLOWPROGTOKENS

1=allow programming tokens to be parsed in BASIC programs

OS_FLAGS_APD

GROUP: Automatic Power-Down.

OS_FLAGS_APD_ABLE

Enable APD.

OS_FLAGS_APD_RUNNING

APD timer active.

OS_FLAGS_APD_WARMSTART

1=calculator is turning on from APD or power loss

OS_FLAGS_ON

GROUP: On key.

OS_FLAGS_ON_PARSEINPUT

1=parse input when done

OS_FLAGS_ON_RUNNING

“1=calculator is running” is literally all TI wrote

OS_FLAGS_ON_INTERRUPT

On key has been pressed at some point.

If this is set, ERR:BREAK will be displayed when the program exits. This is automatically cleared by the C runtime on exit.

OS_FLAGS_STATS

GROUP: Statistics.

OS_FLAGS_STATS_VALID

Reset to recompute stat vars.

OS_FLAGS_FMT

GROUP: Numeric format.

OS_FLAGS_FMT_EXPONENT

1=show exponent, 0=no exponent

OS_FLAGS_FMT_ENG

Engineering notation instead of scientific.

OS_FLAGS_NUMMODE

GROUP: numMode.

OS_FLAGS_FMT_REAL
OS_FLAGS_FMT_RECT
OS_FLAGS_FMT_POLAR
OS_FLAGS_FMTOVERRIDE

GROUP: copy of fmtFlags with conversion override.

OS_FLAGS_CURSOR

GROUP: Homescreen cursor.

OS_FLAGS_CURSOR_ABLE

Cursor blinking enabled.

OS_FLAGS_CURSOR_ON

Cursor is actually being shown this moment.

OS_FLAGS_CURSOR_LOCK

1=cursor is locked off

OS_FLAGS_CMD

GROUP: Command editor.

OS_FLAGS_CMD_VIRGIN

Nothing has been typed so far.

OS_FLAGS_CMD_EXEC

Need to execute a command.

OS_FLAGS_APP

GROUP: Application stuff.

OS_FLAGS_APP_WANTINTERRUPT

Want ON key interrupts.

OS_FLAGS_APP_TEXTSAVE

1=save characters in textShadow

OS_FLAGS_APP_AUTOSCROLL

1=auto-scroll text on last line

OS_FLAGS_APP_MENUS

1=process keys that bring up menus, 0=check Lock menu flag

OS_FLAGS_APP_LOCKMENUS

1=ignore menu keys, 0=switch to home screen and bring up menu

OS_FLAGS_APP_CURGRAPHIC

1=graphic cursor

OS_FLAGS_APP_CURWORD

1=text cursor covers entire word

OS_FLAGS_APP_EXIT

1=application handles [EXIT] key itself

OS_FLAGS_RCL

GROUP: Recall queue.

OS_FLAGS_RCL_ENABLEQUEUE

Enable recall queue.

OS_FLAGS_SEQ

GROUP: Sequential graph.

OS_FLAGS_SEQ_WEBMODE

0 = NORMAL SEQ MODE, 1 = WEB MODE

OS_FLAGS_SEQ_WEBVERT
OS_FLAGS_SEQ_UV

U vs.

V

OS_FLAGS_SEQ_VW

V vs.

W

OS_FLAGS_SEQ_UW

U vs.

W

OS_FLAGS_PROMPT

GROUP: Prompt line.

OS_FLAGS_PROMPT_EDIT

Editing in prompt buffer.

OS_FLAGS_INDIC

GROUP: Run indicator.

OS_FLAGS_INDIC_ENABLE

Set to enable run indicator.

The C runtime resets this automatically.

OS_FLAGS_INDIC_INUSE

indicator save area in use=1, free=0

resetting will disable 2nd while in _getkey

OS_FLAGS_SHIFT

GROUP: [2nd] and [ALPHA].

See also

os_GetKey

See also

sys/getkey.h

OS_FLAGS_SHIFT_2ND

[2nd] has been pressed

OS_FLAGS_SHIFT_ALPHA

[ALPHA] has been pressed

OS_FLAGS_SHIFT_LOWERCASE

Little-a mode.

OS_FLAGS_SHIFT_ALPHALOCK

[2nd]+[ALPHA]

OS_FLAGS_SHIFT_KEEPALPHA

1=cannot cancel alpha shift

OS_FLAGS_TABLE

GROUP: Graph table screen.

OS_FLAGS_TABLE_AUTOFILL

1=prompt, 0=fillAuto

OS_FLAGS_TABLE_AUTOCALC

1=prompt, 0=CalcAuto

OS_FLAGS_TABLE_RETABLE

0=table is okay, 1=must recompute table.

OS_FLAGS_TRACE

GROUP: Trace.

OS_FLAGS_TRACE_EXPRESSION

set to hide expression while tracing

OS_FLAGS_STATS2

GROUP: More stats.

OS_FLAGS_STATS2_DIAGNOSTICS

1 = stat diagnostics on

OS_FLAGS_STATS2_NODEL

1 = don’t delete stats

OS_FLAGS_GRAPH2

GROUP: Graph screen.

OS_FLAGS_GRAPH2_SPLITOVERRIDE

0 = force full screen with ParseInp, or something

OS_FLAGS_ASM1

GROUP: Intentionally unused by TI, available for programs!

OS_FLAGS_ASM2

GROUP: Intentionally unused by TI, available for programs!

OS_FLAGS_ARCHIVE

GROUP: Archive stuff.

OS_FLAGS_ARCHIVE_CHECKBATTERY

1 = check battery levels in Arc_Unarc first and throw error if low

OS_FLAGS_GETSEND

FLAGS.

OS_FLAGS_GETSEND_COMFAILED

1 = Get/Send Communication Failed

OS_FLAGS_SELFTEST

GROUP: Self-test screen.

OS_FLAGS_SELFTEST_RESETONPOWERON

1 = Force RAM reset when APD disabled on next power on

OS_FLAGS_LOWERCASE

GROUP: Enable lowercase flag.

OS_FLAGS_LOWERCASE_ENABLE

Enable lowercase flag.

OS_FLAGS_CONTEXT

GROUP: Context vectors.

OS_FLAGS_CONTEXT_NOCXPUTAWAY

1 = do not call cxPutAway routine

OS_FLAGS_STATUSBAR

FLAGS.

OS_FLAGS_STATUSBAR_NOBARMODE

1 = abort drawing of statusbar mode, like “TEST MODE ENABLED

OS_FLAGS_API1

FLAGS.

OS_FLAGS_API1_APPALLOWCONTEXT

app wants context changes to happen

OS_FLAGS_API1_APPRUNNING

app is currently running

OS_FLAGS_API1_APPRETKEYOFF

1 = GetKey returns kOff when [2nd]+[ON] pressed

OS_FLAGS_API2

FLAGS.

OS_FLAGS_API3

FLAGS.

OS_FLAGS_API4

FLAGS.

OS_FLAGS_API4_CELLOVERRIDE

use cell override

OS_FLAGS_API4_FULLSCRNDRAW

DRAW INTO LAST ROW/COL OF SCREEN.

OS_FLAGS_XAP0

GROUP: External apps.

OS_FLAGS_XAP0_MOUSE

Used by mouse cursor routines.

OS_FLAGS_XAP1

GROUP: External apps.

OS_FLAGS_XAP2

GROUP: External apps.

OS_FLAGS_XAP3

GROUP: External apps.

OS_FLAGS_FONT

FLAGS.

OS_FLAGS_FONT_FRACDRAWLFONT
OS_FLAGS_FONT_FRACTALLLFONT
OS_FLAGS_FONT_CUSTOMFONT
OS_FLAGS_HOOKS1

GROUP: OS hooks, also scriptFlag, rclFlag2, backGroundLink.

You should generally not touch these. The SDK does not have any explicit OS hook support.

OS_FLAGS_HOOKS1_ALT_ON

run ONSCRPT at startup

OS_FLAGS_HOOKS1_ALT_OFF

run OFFSCRPT at shutdown

OS_FLAGS_HOOKS1_USERCLQUEUEEND

1 = external mode

1 = override flag for link activity hook

OS_FLAGS_HOOKS1_BPLINKON

1 = link activity hook active

OS_FLAGS_HOOKS1_ENABLEKEYECHO

1 = sends keypresses back to connected calc as remote control packets (with GetCSC vs.

GetKey codes…really dumb, TI)

OS_FLAGS_HOOKS1_NOTEMPDELETE

1 = do not delete temporary programs at homescreen

OS_FLAGS_HOOKS2

FLAGS; also sysHookFlg.

OS_FLAGS_HOOKS2_GETCSC

1 = GetCSC hook active

OS_FLAGS_HOOKS2_LIBRARY

1 = library hook active

OS_FLAGS_HOOKS2_HOMESCREEN

1 = homescreen hook active

OS_FLAGS_HOOKS2_RAWKEY

1 = raw key hook active

OS_FLAGS_HOOKS2_CATALOG2

1 = catalog 2 hook active

OS_FLAGS_HOOKS2_CURSOR

1 = cursor hook active

OS_FLAGS_HOOKS3

FLAGS; also sysHookFlg1.

OS_FLAGS_HOOKS3_TOKEN

1 = token hook active

OS_FLAGS_HOOKS3_LOCALIZE

1 = localize hook active

OS_FLAGS_HOOKS3_WINDOW

1 = window hook active

OS_FLAGS_HOOKS3_GRAPH

1 = graph hook active

OS_FLAGS_HOOKS3_YEQU

1 = Y= hook active

OS_FLAGS_HOOKS3_FONT

1 = font hook active

OS_FLAGS_HOOKS3_REGRAPH

1 = regraph hook active

OS_FLAGS_HOOKS3_DRAWING

1 = drawing hook active

OS_FLAGS_HOOKS4

FLAGS; also sysHookFlag2.

OS_FLAGS_HOOKS4_TRACE

1 = trace hook active

OS_FLAGS_HOOKS4_PARSER

1 = parser hook active

OS_FLAGS_HOOKS4_APPCHANGE

1 = app change hook active

OS_FLAGS_HOOKS4_CATALOG1

1 = catalog 1 hook active

OS_FLAGS_HOOKS4_HELP

1 = help hook active

OS_FLAGS_HOOKS4_CXREDISP

1 = cxRedisp hook active

OS_FLAGS_HOOKS4_MENU

1 = menu hook active

1 = silent link hook active

OS_FLAGS_HOOKS5

FLAGS.

OS_FLAGS_HOOKS5_USBACTIVITY

1 = USB activity hook active

OS_FLAGS_PLOT3

GROUP: Plot screen.

OS_FLAGS_PLOT3_BUFFERONLY

Draw commands only draw to buffer, not screen.

Will corrupt heap in default configuration.

OS_FLAGS_PLOT3_USEFASTCIRC

Use fast circle routine, which does not pay attention to the aspect ratio of X/Y min/max.

OS_FLAGS_KEYBOARD

GROUP: Originally TI-Keyboard accessory, probably now USB keyboards.

OS_FLAGS_KEYBOARD_DEFAULTS

1 = GetKey returns extended keycodes with TI-Keyboard

FLAGS.

SE/84+ silent link is active.

OS_FLAGS_EXTRAHOOKS

GROUP: Even more hooks.

OS_FLAGS_EXTRAHOOKS_CHECKCAT2VER

1 = check catalog 2 hook’s version before executing it (and error or take other action if so)

OS_FLAGS_EXTRAHOOKS_OPENLIBACTIVE

1 = OpenLib( was successfully called on a Flash application (ExecLib will error if zero)

OS_FLAGS_CLOCK

GROUP: Clock.

OS_FLAGS_CLOCK_NOTMDYMODE

0 = M/D/Y format

OS_FLAGS_CLOCK_ISYMDMODE

1 = Y/M/D format

OS_FLAGS_CLOCK_IS24HOUR

1 = clock in 24 hour mode

OS_FLAGS_CLOCK_INAFTERNOON

1 = current time is in afternoon (PM) (I think)

OS_FLAGS_CLOCK_USETOKENSINSTRING

1 = use tokens instead of characters when displaying clock as string (for getTmStr and getDtStr vs.

MODE screen) (keep this reset)

OS_FLAGS_CLOCK_DISPLAYCLOCK

1 = display clock (this is set every second, reset otherwise)

OS_FLAGS_CLOCK_CLOCKON

1 = clock on

OS_FLAGS_MATHPRINT

GROUP: MathPrint.

OS_FLAGS_MATHPRINT_ENABLED

1 = use mathprint styling

OS_FLAGS_BOOTMENU

FLAGS.

OS_FLAGS_BOOTMENU_DISPINITIALMENU

1 = don’t display the initial boot menu

OS_FLAGS_BACKLIGHT

FLAGS.

OS_FLAGS_BACKLIGHT_RESTORE

1 = restore lcd brightness when needed

OS_FLAGS_GRAPH3

FLAGS.

OS_FLAGS_GRAPH3_DRAWLABELS

1 = don’t draw Graph Labels (this is usually reset anyway)

OS_FLAGS_PUTMAP

GROUP: putMap.

OS_FLAGS_PUTMAP_USEPIXELSHADOW2

1 = use pixelshadow2, not pixelshadow

OS_FLAGS_PUTMAP_USECOLOR

1 = use custom color

OS_FLAGS_GRAPHDISP

FLAGS.

OS_FLAGS_GRAPHDISP_BACKGROUNDVALID

1 = items in graph background are still valid

os_Flags

Functions

void os_SetFlagByte(int offset, uint8_t set)

Set a particular OS flag.

Parameters
  • offset[in] Offset to particular flag in list

  • set[in] Bitmask of flag to set

uint8_t os_GetFlagByte(int offset)

Get a particular OS flag.

Parameters

offset[in] Offset to particular flag in list

Returns

Bitmask of flag

int os_TestFlagBits(uint16_t offset_pattern)

Check OS flag bits.

Parameters

offset_pattern – High 8 is unsigned offset, low 8 is bits to test

Returns

1 if set, 0 if not set

void os_SetFlagBits(int16_t offset_pattern)

Set OS flag bits.

Parameters

offset_pattern – High 8 is unsigned offset, low 8 is bits to test

void os_ResetFlagBits(int16_t offset_pattern)

Clear OS flag bits.

Parameters

offset_pattern – High 8 is unsigned offset, low 8 is bits to test

bool os_TestFlagBitsFast(uint16_t offset_pattern)

Faster (and worse) test of OS flag bits.

Note

This function is only available on OS 5.3.6 or later.

Warning

Has a bug if bits and flags are all set!

Parameters

offset_pattern – High 8 is unsigned offset, low 8 is bits to test