AVR opcodes
Most are single 16
bit words; four marked * have a second word to define
an address or address
extension (kkkk kkkk kkkk kkkk)
d
bits that specify an Rd (0..31 or 16..31 or 16..23 or 24..30)
r
bits that specify an Rr ( - ditto - )
k bits that specify a constant or an address
q
bits that specify an offset
-
bit that specifies pre-decrement mode: 0=no, 1=yes
+
bit that specifies post-decrement mode: 0=no, 1=yes
x
bit of any value
s
bits that specify a status bit (0..7)
A bits that specify i/o
memory
b
bits that define a bit (0..7)
Note: all bits shown
as . are the same as in the row above.
|
0000 0000 0000
0000 NOP .... 0001 dddd
rrrr MOVW .... 0010 dddd rrrr MULS .... 0011 0ddd 0rrr MULSU .... .... 0... 1... FMUL .... .... 1... 0... FMULS .... .... 1... 1... FMULSU .... 01rd dddd rrrr CPC .... 10.. ....
.... SBC .... 11.. ....
.... ADD 0001 00.. ....
.... CPSE .... 01.. ....
.... CP .... 10.. ....
.... SUB .... 11.. ....
.... ADC 0010 00.. ....
.... AND .... 01.. ....
.... EOR .... 10.. ....
.... OR .... 11.. ....
.... MOV 0011 kkkk dddd
kkkk CPI 0100 .... ....
.... SBCI 0101 .... ....
.... SUBI 0110 .... ....
.... ORI 0111 .... ....
.... ANDI 1000 000d dddd 0000 LD Z .... .... ....
1... LD Y 10q0 qq0d dddd
0qqq LDD Z .... .... ....
1... LDD Y .... ..1. ....
0... STD Z .... .... ....
1... STD Y 1001 000d dddd 0000 LDS * .... .... .... 00-+ LD –Z+ .... .... ....
010+ LPM Z .... .... ....
011+ ELPM Z .... .... ....
10-+ LD –Y+ .... .... ....
11-+ LD X .... .... ....
1111 POP .... 001r rrrr
0000 STS * .... .... ....
00-+ ST –Z+ .... .... ....
01xx ??? .... .... ....
10-+ ST –Y+ .... .... ....
11-+ ST X .... ...d dddd
1111 PUSH .... 010d dddd
0000 COM |
.... .... ....
0001 NEG .... .... ....
0010 SWAP .... .... .... 0011 INC .... .... ....
0100 ??? .... .... ....
0101 ASR .... .... ....
0110 LSR .... .... .... 0111
ROR .... .... ....
1010 DEC .... 0100 0sss
1000 BSET .... .... 1...
.... BCLR .... .... 0000
1001 IJMP .... .... ...1
.... EIJMP .... 0101 0000
1000 RET .... .... ....
1001 ICALL .... .... 0001
1000 RETI .... .... ....
1001 EICALL .... .... 1000
1000 SLEEP .... .... 1001
.... BREAK .... .... 1010
.... WDR .... .... 1100
.... LPM .... .... 1101
.... ELPM .... .... 1110
.... SPM .... .... 1111
.... ESPM .... 010k
kkkk 110k JMP * .... .... ....
..1. CALL * .... 0110 kkdd
kkkk ADIW .... 0111 ....
.... SBIW .... 1000 AAAA
Abbb CBI .... 1001 ....
.... SBIC .... 1010 ....
.... SBI .... 1011 ....
.... SBIS .... 11rd
dddd rrrr MUL 1011 0AAd dddd
AAAA IN .... 1..r rrrr
.... OUT 1100 kkkk kkkk
kkkk RJMP 1101 .... ....
.... RCALL 1110 kkkk dddd
kkkk LDI 1111 00kk kkkk
ksss BRBS .... 01.. ....
.... BRBC .... 100d dddd
0bbb BLD .... 101. .... .... BST .... 110r rrrr 0bbb SBRC .... 111. .... .... SBRS |