Arithmetic operations
Operarions | Behavior | Remarks |
---|---|---|
ADD | A + B | Addition. Also it is used for address generation. |
DEC | A-- | Decrement. Also it is used for stack operation. |
INC | A++ | Inclement. Also it is used for stack operation. |
SUB | A - B | Subtraction. |
Logical operation
Operations | Behavior | Remarks |
---|---|---|
OR | A | B | Bitwise logical or. |
XOR | A ^ B | Bitwise logical xor. |
AND | A & B | Bitwise logical and. |
NOT | ~A | Bitwise not. Same as 1's complement. |
Shift and rotation
Operations | Behavior | Remarks |
---|---|---|
ASR | operand / 2 | 1 bit arithmetic right shift. Same as divide by 2. |
ASL | operand * 2 | 1 bit arithmetic left shift. Same as multiply 2. |
LSR | (operand / 2) & 0x7fff | 1 bit logical right shift. |
LSL | operand * 2 | 1 bit logical left shift. The result becomes the same as the arithmetic left shift but differs from flag behavior. |
ROR | 1 bit rotate right. | The 1-bit clockwise-rotation of operand. |
ROL | 1 bit rotate left. | The 1-bit anticlockwise-rotation of operand |
SWP | Exchange of the high byte and the low-byte. | It is possible to operate a byte unit. |
Special operation
Operation | Behavior | Remarks |
---|---|---|
PAS | Through the operand | It is used at the inter-register data transfer. |
It designs ALU by the following procedure and it simulates it.