You are on page 1of 2

Arithmetic and Logic Instructions

Mnemonic Operands Description Operation Flags Cycles

ADD ADC ADIW S!" S!"I S"C S"CI AND ANDI +R +RI ,+R C+0 N,6 S"R C"R INC D,C TST C'R S,R S"IW 0!' 0!'S 0!'S! 50!' 50!'S 50!'S!

Rd,Rr Rd,Rr Rd, K Rd,Rr Rd,K& Rd,Rr Rd,K& Rd,Rr Rd,K& Rd,Rr Rd,K& Rd,Rr Rd Rd Rd,K& Rd,K& Rd Rd Rd Rd Rd Rd),K; Rd,Rr Rd,Rr Rd,Rr Rd,Rr Rd,Rr Rd,Rr

Add without Carry Add with Carry Add Immediate To Word Su#tra$t without Carry Su#tra$t Immediate Su#tra$t with Carry Su#tra$t with Carry Immedtiate 'o(i$a) AND 'o(i$a) AND with Immediate 'o(i$a) +R 'o(i$a) +R with Immediate 'o(i$a) ,-$)u.i/e +R +1e2. Com3)eme1t Two2. Com3)eme1t Set "it8.9 i1 Re(i.ter C)ear "it8.9 i1 Re(i.ter I1$reme1t Re(i.ter De$reme1t Re(i.ter Te.t :or Zero or Ne(ati/e C)ear Re(i.ter Set Re(i.ter Su#tra$t Immediate :rom Word 0u)ti3)y !1.i(1ed 0u)ti3)y Si(1ed 0u)ti3)y Si(1ed with !1.i(1ed 5ra$tio1a) 0u)ti3)y !1.i(1ed 5ra$tio1a) 0u)ti3)y Si(1ed 5ra$tio1a) 0u)ti3)y Si(1ed with !1.i(1ed

Rd = Rd + Rr Rd = Rd + Rr + C Rd+1:Rd,K Rd = Rd % Rr Rd = Rd % K& Rd = Rd % Rr % C Rd = Rd % K& % C Rd = Rd * Rr Rd = Rd * K& Rd = Rd V Rr Rd = Rd V K& Rd = Rd ,+R Rr Rd = 455 % Rd Rd = 477 % Rd Rd = Rd V K& Rd = Rd * 8455 % K&9 Rd = Rd + 1 Rd = Rd %1 Rd = Rd * Rd Rd = 7 Rd = 455 Rdh:Rd) = Rdh:Rd) % K ; R1:R7 = Rd < Rr R1:R7 = Rd < Rr R1:R7 = Rd < Rr R1:R7 = 8Rd < Rr9 == 1 R1:R7 = 8Rd <Rr9 == 1 R1:R7 = 8Rd < Rr9 == 1

Z,C,N,V,H,S Z,C,N,V,H,S Z,C,N,V,S Z,C,N,V,H,S Z,C,N,V,H,S Z,C,N,V,H,S Z,C,N,V,H,S Z,N,V,S Z,N,V,S Z,N,V,S Z,N,V,S Z,N,V,S Z,C,N,V,S Z,C,N,V,H,S Z,C,N,V,S Z,C,N,V,S Z,N,V,S Z,N,V,S Z,C,N,V,S Z,C,N,V,S No1e Z,C,N,V,S Z,C Z,C Z,C Z,C Z,C Z,C

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Branch Instructions
Mnemonic Operands Description Operation Flags Cycles

R>0? I>0? >0? RCA'' ICA'' CA'' R,T R,TI C?S, C? C?C C?I S"RC S"RS S"IC S"IS "R"C "R"S "R,F "RN, "RCS "RCC "RSH "R'+ "R0I "R?' "R6, "R'T "RHS "RHC "RTS "RTC "RVS "RVC "RI, "RID

@ No1e @ @ No1e @ No1e No1e Rd,Rr Rd,Rr Rd,Rr Rd,K& Rr,# Rr,# ?,# ?,# .,@ .,@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

Re)ati/e >um3 I1dire$t >um3 to 8Z9 >um3 Re)ati/e Ca)) Su#routi1e I1dire$t Ca)) to 8Z9 Ca)) Su#routi1e Su#routi1e Retur1 I1terru3t Retur1 Com3are, S@i3 i: eEua) Com3are Com3are with Carry Com3are with Immediate S@i3 i: #it i1 re(i.ter $)eared S@i3 i: #it i1 re(i.ter .et S@i3 i: #it i1 IB+ re(i.ter $)eared S@i3 i: #it i1 IB+ re(i.ter .et "ra1$h i: Statu. :)a( $)eared "ra1$h i: Statu. :)a( .et "ra1$h i: eEua) "ra1$h i: 1ot eEua) "ra1$h i: $arry .et "ra1$h i: $arry $)eared "ra1$h i: .ame or hi(her "ra1$h i: )ower "ra1$h i: mi1u. "ra1$h i: 3)u. "ra1$h i: )e.. tha1 8.i(1ed9 "ra1$h i: ha): $arry :)a( .et "ra1$h i: ha): $arry :)a( $)eared "ra1$h i: T :)a( .et "ra1$h i: T :)a( $)eared "ra1$h i: o/er:)ow :)a( .et "ra1$h i: o/er:)ow :)a( $)eared "ra1$h i: i1terru3t e1a#)ed "ra1$h i: i1terru3t di.a#)ed

?C = ?C + @ +1 ?C = Z ?C = @ STACK = ?C+1, ?C = ?C + @ + 1 STACK = ?C+1, ?C = Z STACK = ?C+ , ?C = @ ?C = STACK ?C = STACK i: 8Rd ==Rr9 ?C = ?C Rd %Rr Rd % Rr % C Rd % K i:8Rr8#9==79 ?C = ?C + i:8Rr8#9==19 ?C = ?C + or A or A or A or A or A

No1e No1e No1e No1e No1e No1e No1e I No1e Z,C,N,V,H,S Z,C,N,V,H,S Z,C,N,V,H,S No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e A ABC< ABC< CBD< CBD< CBD< 1B BA 1 1 1 1B BA 1B BA 1B BA 1B BA 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B

i:8IB+8?,#9==79 ?C = ?C + i:8IB+8?,#9==19 ?C = ?C +

i:8SR,68.9==79 ?C = ?C + @ + 1 i:8SR,68.9==19 ?C = ?C + @ + 1 i:8Z==19 ?C = ?C + @ + 1 i:8Z==79 ?C = ?C + @ + 1 i:8C==19 ?C = ?C + @ + 1 i:8C==79 ?C = ?C + @ + 1 i:8C==79 ?C = ?C + @ + 1 i:8C==19 ?C = ?C + @ + 1 i:8N==19 ?C = ?C + @ + 1 i:8N==79 ?C = ?C + @ + 1 i:8S==19 ?C = ?C + @ + 1 i:8H==19 ?C = ?C + @ + 1 i:8H==79 ?C = ?C + @ + 1 i:8T==19 ?C = ?C + @ + 1 i:8T==79 ?C = ?C + @ + 1 i:8V==19 ?C = ?C + @ + 1 i:8V==79 ?C = ?C + @ + 1 i:8I==19 ?C = ?C + @ + 1 i:8I==79 ?C = ?C + @ + 1

"ra1$h i: (reater tha1 or eEua) 8.i(1ed9 i:8S==79 ?C = ?C + @ + 1

Data Transfer Instructions


Mnemonic Operands Description Operation Flags Cycles

0+V 0+VW 'DI 'DS 'D 'D 'D 'D 'D 'D 'DD 'D 'D 'D 'DD STS ST ST ST ST STD ST ST ST ST ST STD '?0 '?0 '?0 S?0 IN +!T ?!SH ?+?
Mnemonic

Rd,Rr Rd,Rr Rd,K& Rd,@ Rd,G Rd,G+ Rd,%G Rd,H Rd,H+ Rd,%H Rd,H+E Rd,Z Rd,Z+ Rd,%Z Rd,Z+E @,Rr G,Rr G+,Rr %G,Rr H,Rr H+,Rr %H,Rr H+E,Rr Z,Rr Z+,Rr %Z,Rr Z+E,Rr No1e Rd,Z Rd,Z+ No1e Rd,? ?,Rr Rr Rd
Operands

Co3y re(i.ter Co3y re(i.ter 3air 'oad Immediate 'oad Dire$t 'oad I1dire$t 'oad I1dire$t a1d ?o.t%I1$reme1t 'oad I1dire$t a1d ?re%De$reme1t 'oad I1dire$t 'oad I1dire$t a1d ?o.t%I1$reme1t 'oad I1dire$t a1d ?re%De$reme1t 'oad I1dire$t with di.3)a$eme1t 'oad I1dire$t 'oad I1dire$t a1d ?o.t%I1$reme1t 'oad I1dire$t a1d ?re%De$reme1t 'oad I1dire$t with di.3)a$eme1t Store Dire$t Store I1dire$t Store I1dire$t a1d ?o.t%I1$reme1t Store I1dire$t a1d ?re%De$reme1t Store I1dire$t Store I1dire$t a1d ?o.t%I1$reme1t Store I1dire$t a1d ?re%De$reme1t Store I1dire$t with di.3)a$eme1t Store I1dire$t Store I1dire$t a1d ?o.t%I1$reme1t Store I1dire$t a1d ?re%De$reme1t Store I1dire$t with di.3)a$eme1t 'oad ?ro(ram 0emory 'oad ?ro(ram 0emory 'oad ?ro(ram 0emory a1d ?o.t%I1$reme1t Store ?ro(ram 0emory I1 ?ort +ut ?ort ?u.h re(i.ter o1 Sta$@ ?o3 re(i.ter :rom Sta$@
Description

Rd = Rr Rd+1:Rd = Rr+1:Rr, r,d e/e1 Rd = K Rd = 8@9 Rd = 8G9 Rd = 8G9, G=G+1 G=G%1, Rd = 8G9 Rd = 8H9 Rd = 8H9, H=H+1 H=H%1, Rd = 8H9 Rd = 8H+E9 Rd = 8Z9 Rd = 8Z9, Z=Z+1 Z=Z%1, Rd = 8Z9 Rd = 8Z+E9 8@9 = Rr 8G9 = Rr 8G9 = Rr, G=G+1 G=G%1, 8G9=Rr 8H9 = Rr 8H9 = Rr, H=H+1 H=H%1, 8H9 = Rr 8H+E9 = Rr 8Z9 = Rr 8Z9 = Rr, Z=Z+1 Z=Z%1, 8Z9 = Rr 8Z+E9 = Rr R7 = 8Z9 Rd = 8Z9 Rd = 8Z9, Z=Z+1 8Z9 = R1:R7 Rd = ? ? = Rr STACK = Rr Rd = STACK Bit and Bit-test Instructions
Operation Flags

No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e

1 1 1 < < < < < < < < < < < < < < < < <

A A A % 1 1

Cycles

'S' 'SR R+' R+R ASR SWA? "S,T "C'R S"I C"I "ST "'D S,C C'C S,N C'N S,Z C'Z S,I C'I S,S C'N S,V C'V S,T C'T S,H C'H N+? S',,? WDR

Rd Rd Rd Rd Rd Rd . . ?,# ?,# Rr,# Rd,# No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e No1e

'o(i$a) .hi:t )e:t 'o(i$a) .hi:t ri(ht Rotate )e:t throu(h $arry Rotate ri(ht throu(h $arry Arithmeti$ .hi:t ri(ht Swa3 1i##)e. Set :)a( C)ear :)a( Set #it i1 IB+ re(i.ter C)ear #it i1 IB+ re(i.ter "it .tore :rom re(i.ter to T "it )oad :rom re(i.ter to T Set $arry :)a( C)ear $arry :)a( Set 1e(ati/e :)a( C)ear 1e(ati/e :)a( Set Kero :)a( C)ear Kero :)a( Set i1terru3t :)a( C)ear i1terru3t :)a( Set .i(1ed :)a( C)ear .i(1ed :)a( Set o/er:)ow :)a( C)ear o/er:)ow :)a( Set T%:)a( C)ear T%:)a( Set ha): $arry :)a( C)ear ha): $arry :)a( No o3eratio1 S)ee3 Wat$hdo( Re.et

Rd81+19=Rd819, Rd879=7, C=Rd8I9 Rd819=Rd81+19, Rd8I9=7, C=Rd879 Rd879=C, Rd81+19=Rd819, C=Rd8I9 Rd8I9=C, Rd819=Rd81+19, C=Rd879 Rd819=Rd81+19, 1=7,JJJ,; Rd8AJJ79 = Rd8IJJC9, Rd8IJJC9 = Rd8AJJ79 SR,68.9 = 1 SR,68.9 = 7 IB+8?,#9 = 1 IB+8?,#9 = 7 T = Rr8#9 Rd8#9 = T C =1 C=7 N=1 N=7 Z=1 Z=7 I=1 I=7 S=1 S=7 V=1 V=7 T=1 T=7 H=1 H=7 No1e See i1.tru$tio1 ma1ua) See i1.tru$tio1 ma1ua)

Z,C,N,V,H,S Z,C,N,V,S Z,C,N,V,H,S Z,C,N,V,S Z,C,N,V,S No1e SR,68.9 SR,68.9 No1e No1e T No1e C C N N Z Z I I S S V V T T H H No1e No1e No1e

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

You might also like