Arithmetic and Logic Instructions

Many AVR instructions operate only on registers. For example:
AssemblerOpcodeSemantics
MOV Rd,Rr0010 11rd dddd rrrrRd = Rr
ADD Rd,Rr0001 11rd dddd rrrrRd = Rd + Rr
SUB Rd,Rr0001 10rd dddd rrrrRd = Rd - Rr
AND Rd,Rr0010 00rd dddd rrrrRd = Rd & Rr
OR Rd,Rr 0010 10rd dddd rrrrRd = Rd | R
EOR Rd,Rr0010 01rd dddd rrrrRd = Rd ^ Rr
LSR Rd 1001 010d dddd 0110Rd = Rd >> 1
ASR Rd 1001 010d dddd 0101Rd = (Rd & 0x80) | (Rd >> 1)
The signed multiply instruction (MULS) is an example of an AVR instruction which treats a pair of 8-bit registers as a 16-bit value.
MULS Rd,Rr0000 0010 dddd rrrrR0:R1 = Rd * Rr
Note, 16 is added to the 4-bit register patterns for MULS. Hence, only registers 16..31 can be operands for this instruction.

Index