EasyManuals Logo
Home>Texas Instruments>Calculator>TI-92+

Texas Instruments TI-92+ User Manual

Texas Instruments TI-92+
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #105 background imageLoading...
Page #105 background image
Next, suppose that status is 0b00000111. To clear bit 1, use
bitclr(status,1)status
then status would be 0b00000101.
We may need to reverse the status of a flag, and bitnot() is used to do that. Suppose that status is
0b00000000, then
bitnot(status,7)status
results in status = 0b10000000, and bit 7 has been changed from 0 to 1.
Our program will need to decide what actions to take if certain flags are set or cleared. To perform a
block of operations if flag 5 is set, use
if bittst(status,5) then
... {block} ...
endif
Or, to perform a block of operations if flag 7 is cleared, use
if not bittst(status,7) then
... {block} ...
endif
Note that the not operator is used to invert the result of bittst().
All the examples shown so far have used a single 32-bit integer to hold the status flags. If you need
more than 32 flags, you can use the same functions, but use a list of 32-bit integers instead of a single
integer. For example, if we need 96 flags, we would use a list of three integers. The following example
shows how to initialize such a list, then perform various operations on the flags in the list.
...
© Clear all the flags
{0,0,0}statl
...
© Set bit 22
bitset(statl,22)statl
...
© Clear bit 87
bitclr(statl,87)statl
...
© Execute {block} if bit 17 is set
if bittst(statl,17) then
...{block}...
endif
For the purposes of the functions, you can consider the flag list to be a single integer which is 32*n
bits, where n is the number of list elements. In reality, the flag bits are not numbered consecutively in
the list. The bit numbers start at the least significant bit of the first element, and end at the most
significant bit of the last element. For our example above, the bit numbers of the three integers are
{ |31|30|29|...|2|1|0|, |63|62|61|...|34|33|32|, |95|94|93|...|66|65|64| }
3 - 23

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-92+ and is the answer not in the manual?

Texas Instruments TI-92+ Specifications

General IconGeneral
BrandTexas Instruments
ModelTI-92+
CategoryCalculator
LanguageEnglish

Related product manuals