|  
 |  | | PicPuter 2.0 : Chapter 4 : Math Operations |  
  BooleanArithmeticLogic   
  4. Math Operations |  
 
     Tests whether the two values are equal.
   Results is 1 if test is true, 0 if test is false.
   
70 a=0 
72 do 
74 PRINT a 
76 a=a+1 
78 while a == 1 
  Output:
 
0 1
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.02 | ! = |   Boolean Not Equals |  
  Tests whether the two values are not equal.
   Results in 1 if test is true, 0 if test is false.
   
1 a=0 
5 do 
10 PRINT a 
15 a=a+1 
20 while a != 3
  
  Output:
 
0 1 2
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.03 | > |   Boolean Greater Than |  
  Tests whether the first value is greater than the second value.
   Results in 1 if test is true, 0 if test is false.
   
1 a=0 
5 do 
10 PRINT a 
15 a=a+1 
20 while a > 3
  
  Output:
 
0
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.04 | < |   Boolean Less Than |  
  Tests whether the first value is less than the second value.
   Results in 1 if test is true, 0 if test is false.
   
1 a=0 
5 do 
10 PRINT a 
15 a=a+1 
20 while a < 3
  
  Output:
 
0 1 2
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.05 | >= |   Boolean Greater Than or Equal To |  
  Tests whether the first value is greater than or equal to the second value.
   Results in 1 if test is true, 0 if test is false.
   
PRINT 5 >= 3 
  Output:
 
1
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.06 | <= |   Boolean Less Than or Equal To |  
  Tests whether the first value is less than or equal to the second value.
   Results in 1 if test is true, 0 if test is false.
   
1 a=0 
5 do 
10 PRINT a 
15 a=a+1 
20 while a <= 3
  
  Output:
 
0 1 2 3
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]    Adds two numbers.
   
PRINT 5 + 3 
  Output:
 
8
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.08 | - |  Subtracts two numbers |  
  Subtracts two numbers.
   
PRINT 5 - 3 
  Output:
 
2
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.09 | * |  [reg|var|const] * [reg|var|const] |  
  Multiplies two numbers.
   
PRINT 5 * 3 
  Output:
 
15
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.10 | .* |  [reg|var|const] .* [reg|var|const] |  
  Multiplies two numbers, shifts the result 8 bits right.
   
PRINT $500 .* 3 
  Output:
 
15
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.11 | / |  [reg|var|const]/ [reg|var|const] |  
  Divides two numbers.
   Note: there seems to be a __BUG__ that causes incorect results if your divisor is greater than 156 or so.  
PRINT 5 / 3 
  Output:
 
1
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.12 | % |  [reg|var|const] % [reg|var|const] |  
  Gives you the remainder of a divide.
   
PRINT 5 % 3 
  Output:
 
2
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.13 | MIN |  [reg|var|const] MIN [reg|var|const] |  
  Returns the smaller of the two numbers.
   
PRINT 5 MIN 3 
  Output:
 
3
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.14 | MAX |  [reg|var|const] MAX [reg|var|const] |  
  Returns the larger of the two numbers.
   
PRINT 5 MAX 3 
  Output:
 
5
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.15 | >> |  [reg|var|const] >>[reg|var|const] |  
  Arithmetic Rotate Right.
   
PRINT 8 >> 2  
  Output:
 
2
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.15 | << |  [reg|var|const]<< [reg|var|const] |  
  Arithmetic Rotate Left.
   
PRINT 2 << 2  
  Output:
 
8
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.17 | AND  & |   Bitwise [reg|var|const] AND [reg|var|const] |  
  Performs a bitwise 'AND' of the two operands.
   
PRINT 5 AND 3 
  Output:
 
1
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.18 | OR |   Bitwise [reg|var|const] OR [reg|var|const] |  
  Performs a bitwise 'OR' of the two operands.
   
PRINT 5 OR 3 
  Output:
 
7
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.19 | XOR  ^ |   Bitwise [reg|var|const] XOR [reg|var|const] |  
  Performs a bitwise 'XOR' of the two operands.
   
PRINT 5 XOR 3 
  Output:
 
6
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.20 | NAND |   Bitwise ~[reg|var|const] AND ~[reg|var|const] |  
  Performs a bitwise 'NAND' of the two operands.
   
PRINT$ 5 NAND 3 
  Output:
 
$FFFE
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]   | 4.21 | NOR |   Bitwise ~[[reg|var|const] OR [reg|var|const]] |  
  Performs a bitwise 'NOR' of the two operands.
   
PRINT$ 5 NOR 3 
  Output:
 
$FFF8
    [  index  |  memory  |  math  |  statements  |  variables  |  registers  |  assembler  ]
  |