您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

232 行
8.9KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>AVR Opcodes (Using as)</title>
  16. <meta name="description" content="AVR Opcodes (Using as)">
  17. <meta name="keywords" content="AVR Opcodes (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="AVR_002dDependent.html#AVR_002dDependent" rel="up" title="AVR-Dependent">
  25. <link href="AVR-Pseudo-Instructions.html#AVR-Pseudo-Instructions" rel="next" title="AVR Pseudo Instructions">
  26. <link href="AVR_002dModifiers.html#AVR_002dModifiers" rel="prev" title="AVR-Modifiers">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="AVR-Opcodes"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="AVR-Pseudo-Instructions.html#AVR-Pseudo-Instructions" accesskey="n" rel="next">AVR Pseudo Instructions</a>, Previous: <a href="AVR-Syntax.html#AVR-Syntax" accesskey="p" rel="prev">AVR Syntax</a>, Up: <a href="AVR_002dDependent.html#AVR_002dDependent" accesskey="u" rel="up">AVR-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Opcodes-4"></a>
  63. <h4 class="subsection">9.5.3 Opcodes</h4>
  64. <a name="index-AVR-opcode-summary"></a>
  65. <a name="index-opcode-summary_002c-AVR"></a>
  66. <a name="index-mnemonics_002c-AVR"></a>
  67. <a name="index-instruction-summary_002c-AVR"></a>
  68. <p>For detailed information on the AVR machine instruction set, see
  69. <a href="www.atmel.com/products/AVR">www.atmel.com/products/AVR</a>.
  70. </p>
  71. <p><code>as</code> implements all the standard AVR opcodes.
  72. The following table summarizes the AVR opcodes, and their arguments.
  73. </p>
  74. <div class="smallexample">
  75. <pre class="smallexample"><i>Legend:</i>
  76. r <span class="roman">any register</span>
  77. d <span class="roman">&lsquo;ldi&rsquo; register (r16-r31)</span>
  78. v <span class="roman">&lsquo;movw&rsquo; even register (r0, r2, ..., r28, r30)</span>
  79. a <span class="roman">&lsquo;fmul&rsquo; register (r16-r23)</span>
  80. w <span class="roman">&lsquo;adiw&rsquo; register (r24,r26,r28,r30)</span>
  81. e <span class="roman">pointer registers (X,Y,Z)</span>
  82. b <span class="roman">base pointer register and displacement ([YZ]+disp)</span>
  83. z <span class="roman">Z pointer register (for [e]lpm Rd,Z[+])</span>
  84. M <span class="roman">immediate value from 0 to 255</span>
  85. n <span class="roman">immediate value from 0 to 255 ( n = ~M ). Relocation impossible</span>
  86. s <span class="roman">immediate value from 0 to 7</span>
  87. P <span class="roman">Port address value from 0 to 63. (in, out)</span>
  88. p <span class="roman">Port address value from 0 to 31. (cbi, sbi, sbic, sbis)</span>
  89. K <span class="roman">immediate value from 0 to 63 (used in &lsquo;adiw&rsquo;, &lsquo;sbiw&rsquo;)</span>
  90. i <span class="roman">immediate value</span>
  91. l <span class="roman">signed pc relative offset from -64 to 63</span>
  92. L <span class="roman">signed pc relative offset from -2048 to 2047</span>
  93. h <span class="roman">absolute code address (call, jmp)</span>
  94. S <span class="roman">immediate value from 0 to 7 (S = s &lt;&lt; 4)</span>
  95. ? <span class="roman">use this opcode entry if no parameters, else use next opcode entry</span>
  96. 1001010010001000 clc
  97. 1001010011011000 clh
  98. 1001010011111000 cli
  99. 1001010010101000 cln
  100. 1001010011001000 cls
  101. 1001010011101000 clt
  102. 1001010010111000 clv
  103. 1001010010011000 clz
  104. 1001010000001000 sec
  105. 1001010001011000 seh
  106. 1001010001111000 sei
  107. 1001010000101000 sen
  108. 1001010001001000 ses
  109. 1001010001101000 set
  110. 1001010000111000 sev
  111. 1001010000011000 sez
  112. 100101001SSS1000 bclr S
  113. 100101000SSS1000 bset S
  114. 1001010100001001 icall
  115. 1001010000001001 ijmp
  116. 1001010111001000 lpm ?
  117. 1001000ddddd010+ lpm r,z
  118. 1001010111011000 elpm ?
  119. 1001000ddddd011+ elpm r,z
  120. 0000000000000000 nop
  121. 1001010100001000 ret
  122. 1001010100011000 reti
  123. 1001010110001000 sleep
  124. 1001010110011000 break
  125. 1001010110101000 wdr
  126. 1001010111101000 spm
  127. 000111rdddddrrrr adc r,r
  128. 000011rdddddrrrr add r,r
  129. 001000rdddddrrrr and r,r
  130. 000101rdddddrrrr cp r,r
  131. 000001rdddddrrrr cpc r,r
  132. 000100rdddddrrrr cpse r,r
  133. 001001rdddddrrrr eor r,r
  134. 001011rdddddrrrr mov r,r
  135. 100111rdddddrrrr mul r,r
  136. 001010rdddddrrrr or r,r
  137. 000010rdddddrrrr sbc r,r
  138. 000110rdddddrrrr sub r,r
  139. 001001rdddddrrrr clr r
  140. 000011rdddddrrrr lsl r
  141. 000111rdddddrrrr rol r
  142. 001000rdddddrrrr tst r
  143. 0111KKKKddddKKKK andi d,M
  144. 0111KKKKddddKKKK cbr d,n
  145. 1110KKKKddddKKKK ldi d,M
  146. 11101111dddd1111 ser d
  147. 0110KKKKddddKKKK ori d,M
  148. 0110KKKKddddKKKK sbr d,M
  149. 0011KKKKddddKKKK cpi d,M
  150. 0100KKKKddddKKKK sbci d,M
  151. 0101KKKKddddKKKK subi d,M
  152. 1111110rrrrr0sss sbrc r,s
  153. 1111111rrrrr0sss sbrs r,s
  154. 1111100ddddd0sss bld r,s
  155. 1111101ddddd0sss bst r,s
  156. 10110PPdddddPPPP in r,P
  157. 10111PPrrrrrPPPP out P,r
  158. 10010110KKddKKKK adiw w,K
  159. 10010111KKddKKKK sbiw w,K
  160. 10011000pppppsss cbi p,s
  161. 10011010pppppsss sbi p,s
  162. 10011001pppppsss sbic p,s
  163. 10011011pppppsss sbis p,s
  164. 111101lllllll000 brcc l
  165. 111100lllllll000 brcs l
  166. 111100lllllll001 breq l
  167. 111101lllllll100 brge l
  168. 111101lllllll101 brhc l
  169. 111100lllllll101 brhs l
  170. 111101lllllll111 brid l
  171. 111100lllllll111 brie l
  172. 111100lllllll000 brlo l
  173. 111100lllllll100 brlt l
  174. 111100lllllll010 brmi l
  175. 111101lllllll001 brne l
  176. 111101lllllll010 brpl l
  177. 111101lllllll000 brsh l
  178. 111101lllllll110 brtc l
  179. 111100lllllll110 brts l
  180. 111101lllllll011 brvc l
  181. 111100lllllll011 brvs l
  182. 111101lllllllsss brbc s,l
  183. 111100lllllllsss brbs s,l
  184. 1101LLLLLLLLLLLL rcall L
  185. 1100LLLLLLLLLLLL rjmp L
  186. 1001010hhhhh111h call h
  187. 1001010hhhhh110h jmp h
  188. 1001010rrrrr0101 asr r
  189. 1001010rrrrr0000 com r
  190. 1001010rrrrr1010 dec r
  191. 1001010rrrrr0011 inc r
  192. 1001010rrrrr0110 lsr r
  193. 1001010rrrrr0001 neg r
  194. 1001000rrrrr1111 pop r
  195. 1001001rrrrr1111 push r
  196. 1001010rrrrr0111 ror r
  197. 1001010rrrrr0010 swap r
  198. 00000001ddddrrrr movw v,v
  199. 00000010ddddrrrr muls d,d
  200. 000000110ddd0rrr mulsu a,a
  201. 000000110ddd1rrr fmul a,a
  202. 000000111ddd0rrr fmuls a,a
  203. 000000111ddd1rrr fmulsu a,a
  204. 1001001ddddd0000 sts i,r
  205. 1001000ddddd0000 lds r,i
  206. 10o0oo0dddddbooo ldd r,b
  207. 100!000dddddee-+ ld r,e
  208. 10o0oo1rrrrrbooo std b,r
  209. 100!001rrrrree-+ st e,r
  210. 1001010100011001 eicall
  211. 1001010000011001 eijmp
  212. </pre></div>
  213. <hr>
  214. <div class="header">
  215. <p>
  216. Next: <a href="AVR-Pseudo-Instructions.html#AVR-Pseudo-Instructions" accesskey="n" rel="next">AVR Pseudo Instructions</a>, Previous: <a href="AVR-Syntax.html#AVR-Syntax" accesskey="p" rel="prev">AVR Syntax</a>, Up: <a href="AVR_002dDependent.html#AVR_002dDependent" accesskey="u" rel="up">AVR-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  217. </div>
  218. </body>
  219. </html>