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
5Copyright (C) 1991-2021 Free Software Foundation, Inc.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.3
9or any later version published by the Free Software Foundation;
10with no Invariant Sections, with no Front-Cover Texts, and with no
11Back-Cover Texts.  A copy of the license is included in the
12section entitled "GNU Free Documentation License".
13 -->
14<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
15<head>
16<title>Using as: Z80 Opcodes</title>
17
18<meta name="description" content="Using as: Z80 Opcodes">
19<meta name="keywords" content="Using as: Z80 Opcodes">
20<meta name="resource-type" content="document">
21<meta name="distribution" content="global">
22<meta name="Generator" content="makeinfo">
23<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
24<link href="index.html#Top" rel="start" title="Top">
25<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
26<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
27<link href="Z80_002dDependent.html#Z80_002dDependent" rel="up" title="Z80-Dependent">
28<link href="Z8000_002dDependent.html#Z8000_002dDependent" rel="next" title="Z8000-Dependent">
29<link href="Z80-Directives.html#Z80-Directives" rel="previous" title="Z80 Directives">
30<style type="text/css">
31<!--
32a.summary-letter {text-decoration: none}
33blockquote.smallquotation {font-size: smaller}
34div.display {margin-left: 3.2em}
35div.example {margin-left: 3.2em}
36div.indentedblock {margin-left: 3.2em}
37div.lisp {margin-left: 3.2em}
38div.smalldisplay {margin-left: 3.2em}
39div.smallexample {margin-left: 3.2em}
40div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
41div.smalllisp {margin-left: 3.2em}
42kbd {font-style:oblique}
43pre.display {font-family: inherit}
44pre.format {font-family: inherit}
45pre.menu-comment {font-family: serif}
46pre.menu-preformatted {font-family: serif}
47pre.smalldisplay {font-family: inherit; font-size: smaller}
48pre.smallexample {font-size: smaller}
49pre.smallformat {font-family: inherit; font-size: smaller}
50pre.smalllisp {font-size: smaller}
51span.nocodebreak {white-space:nowrap}
52span.nolinebreak {white-space:nowrap}
53span.roman {font-family:serif; font-weight:normal}
54span.sansserif {font-family:sans-serif; font-weight:normal}
55ul.no-bullet {list-style: none}
56-->
57</style>
58
59
60</head>
61
62<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
63<a name="Z80-Opcodes"></a>
64<div class="header">
65<p>
66Previous: <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>
67</div>
68<hr>
69<a name="Opcodes-22"></a>
70<h4 class="subsection">9.56.5 Opcodes</h4>
71<p>In line with common practice, Z80 mnemonics are used for the Z80,
72Z80N, Z180, eZ80, Ascii R800 and the GameBoy Z80.
73</p>
74<p>In many instructions it is possible to use one of the half index
75registers (&lsquo;<samp>ixl</samp>&rsquo;,&lsquo;<samp>ixh</samp>&rsquo;,&lsquo;<samp>iyl</samp>&rsquo;,&lsquo;<samp>iyh</samp>&rsquo;) in stead of an
768-bit general purpose register. This yields instructions that are
77documented on the eZ80 and the R800, undocumented on the Z80 and
78unsupported on the Z180.
79Similarly <code>in f,(c)</code> is documented on the R800, undocumented on
80the Z80 and unsupported on the Z180 and the eZ80.
81</p>
82<p>The assembler also supports the following undocumented Z80-instructions,
83that have not been adopted in any other instruction set:
84</p><dl compact="compact">
85<dt><code>out (c),0</code></dt>
86<dd><p>Sends zero to the port pointed to by register <code>C</code>.
87</p>
88</dd>
89<dt><code>sli <var>m</var></code></dt>
90<dd><p>Equivalent to <code><var>m</var> = (<var>m</var>&lt;&lt;1)+1</code>, the operand <var>m</var> can
91be any operand that is valid for &lsquo;<samp>sla</samp>&rsquo;. One can use &lsquo;<samp>sll</samp>&rsquo; as a
92synonym for &lsquo;<samp>sli</samp>&rsquo;.
93</p>
94</dd>
95<dt><code><var>op</var> (ix+<var>d</var>), <var>r</var></code></dt>
96<dd><p>This is equivalent to
97</p>
98<div class="example">
99<pre class="example">ld <var>r</var>, (ix+<var>d</var>)
100<var>op</var> <var>r</var>
101ld (ix+<var>d</var>), <var>r</var>
102</pre></div>
103
104<p>The operation &lsquo;<samp><var>op</var></samp>&rsquo; may be any of &lsquo;<samp>res <var>b</var>,</samp>&rsquo;,
105&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;,
106&lsquo;<samp>sla</samp>&rsquo;, &lsquo;<samp>sli</samp>&rsquo;, &lsquo;<samp>sra</samp>&rsquo; and &lsquo;<samp>srl</samp>&rsquo;, and the register
107&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;,
108&lsquo;<samp>e</samp>&rsquo;, &lsquo;<samp>h</samp>&rsquo; and &lsquo;<samp>l</samp>&rsquo;.
109</p>
110</dd>
111<dt><code><var>op</var> (iy+<var>d</var>), <var>r</var></code></dt>
112<dd><p>As above, but with &lsquo;<samp>iy</samp>&rsquo; instead of &lsquo;<samp>ix</samp>&rsquo;.
113</p></dd>
114</dl>
115
116<p>The web site at <a href="http://www.z80.info">http://www.z80.info</a> is a good starting place to
117find more information on programming the Z80.
118</p>
119<p>You may enable or disable any of these instructions for any target CPU
120even this instruction is not supported by any real CPU of this type.
121Useful for custom CPU cores.
122</p>
123<hr>
124<div class="header">
125<p>
126Previous: <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>
127</div>
128
129
130
131</body>
132</html>
133