### Arithmetic and Logic Instructions

An arithmetic or logic instruction computes an 8-bit function of A or of A and B, and it puts the result in A:

InstructionNamePseudocodeOpcode
ANDBitwise ANDA &= B;11
DECDecrement--A;12
INCIncrement++A;13
LS2Logical Left Shift by 2A <<= 2;14
LS3Logical Left Shift by 3A <<= 3;15
LS4Logical Left Shift by 4A <<= 4;16
ORBitwise ORA |= B;17
RS1Logical Right Shift by 1A >>>= 1;18
RS5Logical Right Shift by 5A >>>= 5;19
SUBSubtract (without borrow)A -= B;1A
XORBitwise XORA ^= B;1B

The carry-outs of ADD and INC, the borrow-outs of SUB and DEC, and the shift-outs of the shift instructions are lost. There is no add-with-carry instruction nor a subtract-with-borrow instruction. All shift instructions shift-in 0.

Every arithmetic and logic instruction assigns the zero flag, z, to 1 if the resultant value in A is zero, and to 0, otherwise. Similarly, it assigns the negative flag, n, to 1 if the resultant value in A is negative (if bit-7 is 1), and to 0, otherwise.

The instructions correspond to opcodes with bits 0001xxxx. Of the sixteen possible opcodes, the computer implements the twelve listed above. They were selected to satisfy the requirements of a single program, one that runs Tetris. Potential additions include Bitwise NOT and shifts by other values.