Bob's Calculator Version 2.0 Updated: 2005.02.01  
  Home     Main screen     Forms     Programming     Customization  
   Overview       Run       View       Add/Edit       Commands       Samples   

Families
Conditional
Display
Financial
Integer
Mem
Misc
Ops
Program flow
Stack
Stats
Trig
Value
Conditional
All of the conditional statements compare one value to another value. If the condition is met (true) then the next program step is skipped.  If the condition is false then the next step is executed.  The next step is often a "Goto" or "Gosub" command.

X vs Ycompare X register to Y register
X vs 0compare X register to 0
SFsets a flag register to "true". There are 2 flag registers. Specify SF0 or SF1.
CFsets a flag register to "false".  Specify CF0 or CF1.
F?test if the selected flag is "true".  Specify F?0 or F?1.
ISGIncrements the value of a memory register by a certain amount, then compares the result with a target value. If the result is greater than the target then the next step is skipped.
DSEDecrements the value of a memory register by a certain amount, then compares the result with a target value. If the result is less than, or equal to, the target then the next step is skipped.

The "ISG" and "DSE" commands are very useful in controlling program loops. They use a value stored in a memory register to determine whether or not to skip the next step.  The value can be stored in any of the memory registers (1 to 20) or in the "i" register.  The value in the register must have the following 3-part structure:

NNNN.xxxyy
where...
NNNN is the current value, is the integer of the number.
xxx is the target value, and is the first 3 decimal places.
yy is the increment value, and it is made up of decimal place 4 & 5.

The "ISG" command will first retrieve the register value, then will increment NNNN by an amount equal to yy.  If NNNN is now greater than xxx the next step will be skipped.

For instance, a value of 10.04002 would be interpreted as follows:

Current value=10
Target=040 (or just 40)
Increment=02 (or just 2)


Upon reaching the "ISG" command, the current value would be incremented by 2 (current value now = 12) and it would be compared with 40.  It is NOT greater than 40, so the next step will NOT be skipped.  The value in the register now will be 12.04002.

If the increment value is undefined (= 0) then the increment value will default to 1.

Example:
StepLblActionNote
110.04002Copy 10.04002 into x-register
2Sto5Store this value in memory 5
3aRcl5recall the value from memory 5
4intshow only the integer portion
5pausepause for 1 second
6ISG5use memory 5 as the "ISG" register
7goto aif the current value is NOT > 40 then loop back to label "a"
1r/sstop

This program will start with a value of 10, incrementing it by 2 until the value reaches 40.

"DSE": The "Decrement and skip if equal or less" command works the same as the "ISG" command, except it subtracts the increment amount, and continues until the current value is equal to or less than the target.



(c) 2005 RarM_Software