Z80-Opcodes.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: Z80 Opcodes</title>
  15. <meta name="description" content="Using as: Z80 Opcodes">
  16. <meta name="keywords" content="Using as: Z80 Opcodes">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Z80_002dDependent.html#Z80_002dDependent" rel="up" title="Z80-Dependent">
  25. <link href="Z8000_002dDependent.html#Z8000_002dDependent" rel="next" title="Z8000-Dependent">
  26. <link href="Z80-Directives.html#Z80-Directives" rel="prev" title="Z80 Directives">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="Z80-Opcodes"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Z80-Directives.html#Z80-Directives" accesskey="p" rel="prev">Z80 Directives</a>, Up: <a href="Z80_002dDependent.html#Z80_002dDependent" accesskey="u" rel="up">Z80-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>
  61. </div>
  62. <hr>
  63. <a name="Opcodes-21"></a>
  64. <h4 class="subsection">9.54.5 Opcodes</h4>
  65. <p>In line with common practice, Z80 mnemonics are used for both the Z80 and
  66. the R800.
  67. </p>
  68. <p>In many instructions it is possible to use one of the half index
  69. registers (&lsquo;<samp>ixl</samp>&rsquo;,&lsquo;<samp>ixh</samp>&rsquo;,&lsquo;<samp>iyl</samp>&rsquo;,&lsquo;<samp>iyh</samp>&rsquo;) in stead of an
  70. 8-bit general purpose register. This yields instructions that are
  71. documented on the R800 and undocumented on the Z80.
  72. Similarly <code>in f,(c)</code> is documented on the R800 and undocumented on
  73. the Z80.
  74. </p>
  75. <p>The assembler also supports the following undocumented Z80-instructions,
  76. that have not been adopted in the R800 instruction set:
  77. </p><dl compact="compact">
  78. <dt><code>out (c),0</code></dt>
  79. <dd><p>Sends zero to the port pointed to by register c.
  80. </p>
  81. </dd>
  82. <dt><code>sli <var>m</var></code></dt>
  83. <dd><p>Equivalent to <code><var>m</var> = (<var>m</var>&lt;&lt;1)+1</code>, the operand <var>m</var> can
  84. be any operand that is valid for &lsquo;<samp>sla</samp>&rsquo;. One can use &lsquo;<samp>sll</samp>&rsquo; as a
  85. synonym for &lsquo;<samp>sli</samp>&rsquo;.
  86. </p>
  87. </dd>
  88. <dt><code><var>op</var> (ix+<var>d</var>), <var>r</var></code></dt>
  89. <dd><p>This is equivalent to
  90. </p>
  91. <div class="example">
  92. <pre class="example">ld <var>r</var>, (ix+<var>d</var>)
  93. <var>opc</var> <var>r</var>
  94. ld (ix+<var>d</var>), <var>r</var>
  95. </pre></div>
  96. <p>The operation &lsquo;<samp><var>opc</var></samp>&rsquo; may be any of &lsquo;<samp>res <var>b</var>,</samp>&rsquo;,
  97. &lsquo;<samp>set <var>b</var>,</samp>&rsquo;, &lsquo;<samp>rl</samp>&rsquo;, &lsquo;<samp>rlc</samp>&rsquo;, &lsquo;<samp>rr</samp>&rsquo;, &lsquo;<samp>rrc</samp>&rsquo;,
  98. &lsquo;<samp>sla</samp>&rsquo;, &lsquo;<samp>sli</samp>&rsquo;, &lsquo;<samp>sra</samp>&rsquo; and &lsquo;<samp>srl</samp>&rsquo;, and the register
  99. &lsquo;<samp><var>r</var></samp>&rsquo; may be any of &lsquo;<samp>a</samp>&rsquo;, &lsquo;<samp>b</samp>&rsquo;, &lsquo;<samp>c</samp>&rsquo;, &lsquo;<samp>d</samp>&rsquo;,
  100. &lsquo;<samp>e</samp>&rsquo;, &lsquo;<samp>h</samp>&rsquo; and &lsquo;<samp>l</samp>&rsquo;.
  101. </p>
  102. </dd>
  103. <dt><code><var>opc</var> (iy+<var>d</var>), <var>r</var></code></dt>
  104. <dd><p>As above, but with &lsquo;<samp>iy</samp>&rsquo; instead of &lsquo;<samp>ix</samp>&rsquo;.
  105. </p></dd>
  106. </dl>
  107. <p>The web site at <a href="http://www.z80.info">http://www.z80.info</a> is a good starting place to
  108. find more information on programming the Z80.
  109. </p>
  110. </body>
  111. </html>