Differences
This shows you the differences between two versions of the page.
|
reference:lp0604 [2009/08/04 08:13] don created |
reference:lp0604 [2010/01/17 22:19] (current) don |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== 6.04 Miscellaneous System Commands ====== | + | ====== 6.04 Binary & Logical Operations ====== |
| - | ===== BEEP ===== | + | ===== Binary Operators ===== |
| - | === Function: === | + | Binary operations are used to test and set individual bits and bit combinations. They are most often used when dealing with internal representation on computers. |
| - | Generates a beep sound | + | |
| - | === Syntax: === | + | |
| - | BEEP | + | |
| - | ===== DELAY ===== | + | =**Number Formats** |
| - | === Function: === | + | =&h or 0x |
| - | Delay for a specified amount of milliseconds. This 'delay' is also dependent on system clock. | + | :Prefix for hexadecimal constant (0x1F, &h3C) |
| - | === Syntax: === | + | =&o or 0o |
| - | DELAY ms | + | :Prefix for octal constant (0o33, &o33) |
| + | =&b or 0b | ||
| + | :Prefix for binary constant (0b1010, &b1110) | ||
| - | ===== PAUSE ===== | + | The following operators are used. They are listed in priority order. Those that are in a group that is higher in the list take precedence over those in a group that is lower down the list. |
| - | === Function: === | + | |
| - | Pauses the execution for a specified length of time, or until the user hits the keyboard. | + | |
| - | === Syntax: === | + | |
| - | PAUSE [secs] | + | |
| - | ===== ENVIRON Command ===== | + | =**Operator** |
| - | === Function: === | + | :**Usage** |
| - | Adds a variable to or deletes a variable from the current environment variable-table. | + | =**Binary Operations** |
| - | === Syntax: === | + | =%%<<, >>%% |
| - | ENViron expr | + | :bitwise shift left and shift right.\\ |
| - | =expr | + | 0b0011 %%<<%% 1 -> 0b0110\\ |
| - | :A string expression of the form "name=parameter" | + | 0b1100 %%>>%% 3 -> 0b0001 |
| - | :If name already exists in the environment table, its current setting is replaced with the new setting. If name does not exist, the new variable is added. | + | =~ |
| + | :bitwise NOT (~A).\\ | ||
| + | Result bit is 1 if operand A bit is 0 and vice versa, otherwise result bit is 0.\\ | ||
| + | ~0b1100 -> 0b0011 | ||
| + | =BAND or & | ||
| + | :bitwise AND (A AND B)\\ | ||
| + | Result bit is 1 if both operand bits are 1, otherwise result bit is 0.\\ | ||
| + | 0b1100 & 0b1010 -> 0b1000 | ||
| + | =BOR or %%|%% | ||
| + | :bitwise OR (A OR B)\\ | ||
| + | Result bit is 1 if either operand bit is 1, otherwise result bit is 0.\\ | ||
| + | 0b1100 %%|%% 0b1010 -> 0b1110 | ||
| + | =XOR | ||
| + | :bitwise XOR (A XOR B).\\ | ||
| + | Result bit is 1 if either A is 1 or B is 1 but not both(i.e. not the same), otherwise result bit is 0.\\ | ||
| + | 0b1100 XOR 0b1010 -> 0b0110 | ||
| + | =EQV\\ | ||
| + | XNOR | ||
| + | :bitwise EQV/XNOR (NOT (A XOR B)).\\ | ||
| + | Result bit is 1 if both operand bits are the same, otherwise result bit is 0.\\ | ||
| + | 0b1100 EQV 0b1010 -> 0b1001 | ||
| + | =IMP | ||
| + | :bitwise IMP (NOT (A AND NOT B)).\\ | ||
| + | Result bit is 0 if first operand bit is 1 and second operand bit is 0, otherwise result bit is 1.\\ | ||
| + | 0b1100 IMP 0b1010 -> 0b1011 | ||
| + | =NAND | ||
| + | :bitwise NAND (NOT (A AND B))\\ | ||
| + | Result bit is 0 if both operand bits are 1, otherwise result bit is 0.\\ | ||
| + | 0b1100 NAND 0b1010 -> 0b0111 | ||
| + | =NOR | ||
| + | :bitwise NOR (NOT (A OR B))\\ | ||
| + | Result bit is 1 if both operand bits are 0, otherwise result bit is 1.\\ | ||
| + | 0b1100 NOR 0b1010 -> 0b0001 | ||
| - | ===== ENVIRON Function ===== | + | |
| - | === Function: === | + | ===== Logical Operators ===== |
| - | Returns the value of a specified entry in the current environment table. If the parameter is empty ("") then returns an array of the envirment variables (in var=value form) | + | Logical operations are used to test conditions to determine what action a program should take. |
| - | === Syntax: === | + | |
| - | ENViron(var) | + | =**Operator** |
| - | =var | + | :**Usage** |
| - | :A string expression of the form "var" | + | =NOT or ! |
| + | :Logical NOT (NOT false = true) | ||
| + | == | ||
| + | :Equal | ||
| + | =<> or != | ||
| + | :Not Equal | ||
| + | =<, > | ||
| + | :Less Than, Greater Than | ||
| + | =%%=<, =>, <=, >=%% | ||
| + | :Less Than or Equal, Greater than or Equal | ||
| + | =IN | ||
| + | :belongs to ... (see [[lp0409#The operator IN]]) | ||
| + | =LIKE | ||
| + | :Regular expression match (see [[lp0409#The operator LIKE]]) | ||
| + | =AND or && | ||
| + | :Logical AND (A AND B) | ||
| + | =OR or %%||%% | ||
| + | :Logical OR (A OR B) | ||
| + | |||
| + | ===== Page Links ===== | ||
| + | | <= [[lp0603]] | | [[start]] | | [[lp0605]] => | | ||