Re: Flags in TI Basic


[Prev][Next][Index][Thread]

Re: Flags in TI Basic



Palizer wrote in message
<1998042901181200.VAA19957@ladder01.news.aol.com>...
>Back in the days of the very early programmable TI calculators the
programming
>language included a number of flags which could be set or cleared, and then
>tested later by the program in order to find out what decision was made by
the
>user.


I loved my TI-59 with the PC-100A print cradle dearly!!  I miss single step
debugging, tracing execution,  10 user-definable function keys, mag card
storage!!!

>To this writer, flags are an absolutely essential item in a calculator
>programming language.

Why?

Even today, Hewlet Packard still provides flags in their
>programmable calculaters, and yet, I note they have not been provided in
the
>TI-85/86.
>How did the developers of the TI-85/86 intend this situation to be handled
>without flags?

You can use dozens of flags in a single variable.  Mask out the digits.

To set flag 3 (counting from 0) in varable FLAG:

FLAG or 2^3 -> FLAG

to read flag 3:

Disp (FLAG and 2^3)<>0
(use the not equal sign in place of the <>)

In general
To set bit n:                   FLAG or 2^n ->FLAG
To reset bit n:               FLAG xor 2^n->FLAG
To test bit n:                  (FLAG and 2^n)<>0

I know this isn't exactly what you wanted but I hope it helps some.

Tom Lake


References: