Z80-Opcodes.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 5.1, 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="previous" 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="previous">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-22"></a>
  64. <h4 class="subsection">9.56.5 Opcodes</h4>
  65. <p>In line with common practice, Z80 mnemonics are used for the Z80,
  66. Z80N, Z180, eZ80, Ascii R800 and the GameBoy Z80.
  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 eZ80 and the R800, undocumented on the Z80 and
  72. unsupported on the Z180.
  73. Similarly <code>in f,(c)</code> is documented on the R800, undocumented on
  74. the Z80 and unsupported on the Z180 and the eZ80.
  75. </p>
  76. <p>The assembler also supports the following undocumented Z80-instructions,
  77. that have not been adopted in any other instruction set:
  78. </p><dl compact="compact">
  79. <dt><code>out (c),0</code></dt>
  80. <dd><p>Sends zero to the port pointed to by register <code>C</code>.
  81. </p>
  82. </dd>
  83. <dt><code>sli <var>m</var></code></dt>
  84. <dd><p>Equivalent to <code><var>m</var> = (<var>m</var>&lt;&lt;1)+1</code>, the operand <var>m</var> can
  85. be any operand that is valid for &lsquo;<samp>sla</samp>&rsquo;. One can use &lsquo;<samp>sll</samp>&rsquo; as a
  86. synonym for &lsquo;<samp>sli</samp>&rsquo;.
  87. </p>
  88. </dd>
  89. <dt><code><var>op</var> (ix+<var>d</var>), <var>r</var></code></dt>
  90. <dd><p>This is equivalent to
  91. </p>
  92. <div class="example">
  93. <pre class="example">ld <var>r</var>, (ix+<var>d</var>)
  94. <var>op</var> <var>r</var>
  95. ld (ix+<var>d</var>), <var>r</var>
  96. </pre></div>
  97. <p>The operation &lsquo;<samp><var>op</var></samp>&rsquo; may be any of &lsquo;<samp>res <var>b</var>,</samp>&rsquo;,
  98. &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;,
  99. &lsquo;<samp>sla</samp>&rsquo;, &lsquo;<samp>sli</samp>&rsquo;, &lsquo;<samp>sra</samp>&rsquo; and &lsquo;<samp>srl</samp>&rsquo;, and the register
  100. &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;,
  101. &lsquo;<samp>e</samp>&rsquo;, &lsquo;<samp>h</samp>&rsquo; and &lsquo;<samp>l</samp>&rsquo;.
  102. </p>
  103. </dd>
  104. <dt><code><var>op</var> (iy+<var>d</var>), <var>r</var></code></dt>
  105. <dd><p>As above, but with &lsquo;<samp>iy</samp>&rsquo; instead of &lsquo;<samp>ix</samp>&rsquo;.
  106. </p></dd>
  107. </dl>
  108. <p>The web site at <a href="http://www.z80.info">http://www.z80.info</a> is a good starting place to
  109. find more information on programming the Z80.
  110. </p>
  111. <p>You may enable or disable any of these instructions for any target CPU
  112. even this instruction is not supported by any real CPU of this type.
  113. Useful for custom CPU cores.
  114. </p>
  115. <hr>
  116. <div class="header">
  117. <p>
  118. Previous: <a href="Z80-Directives.html#Z80-Directives" accesskey="p" rel="previous">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>
  119. </div>
  120. </body>
  121. </html>