<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AOpcodes%3AEX</id>
	<title>Z80:Opcodes:EX - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AOpcodes%3AEX"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Opcodes:EX&amp;action=history"/>
	<updated>2026-06-16T14:42:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Opcodes:EX&amp;diff=287&amp;oldid=prev</id>
		<title>Maintenance script: Initial automated import</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Opcodes:EX&amp;diff=287&amp;oldid=prev"/>
		<updated>2016-02-05T22:16:39Z</updated>

		<summary type="html">&lt;p&gt;Initial automated import&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;!-- Short summary of instruction --&amp;gt;&lt;br /&gt;
Exchanges two 16-bit values.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Syntax for this instruction --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ex op16,op16&lt;br /&gt;
&lt;br /&gt;
=== Allowed Instructions ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- All possible inputs --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ex af,af&amp;#039;&lt;br /&gt;
    ex de,hl&lt;br /&gt;
    ex (sp),hl&lt;br /&gt;
    ex (sp),ix&lt;br /&gt;
    ex (sp),iy&lt;br /&gt;
&lt;br /&gt;
== Effects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- What the instruction does to flags --&amp;gt;&lt;br /&gt;
Flags are preserved.&lt;br /&gt;
&lt;br /&gt;
== Uses ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- What the instruction can be used for --&amp;gt;&lt;br /&gt;
EX DE,HL exchanges HL with DE. Note that IX and IY do not work with this command.&lt;br /&gt;
EX (SP),HL exchanges HL with the last pushed value on the stack.&lt;br /&gt;
EX AF,AF&amp;#039; exchanges AF with its shadow register. This is mostly used as an alternative to pushing AF to the stack during interrupts. Note that the flags will most likely not be the same after this command.&lt;br /&gt;
&lt;br /&gt;
== T-States ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
| de, hl || 4 &lt;br /&gt;
|-&lt;br /&gt;
| af, af&amp;#039; || 4 &lt;br /&gt;
|-&lt;br /&gt;
| (sp),hl || 19 &lt;br /&gt;
|-&lt;br /&gt;
| (sp),ix || 19 &lt;br /&gt;
|-&lt;br /&gt;
| (sp),iy || 19 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Other instructions that are related to this one --&amp;gt;&lt;br /&gt;
[[Z80:Opcodes:EXX|EXX]]&lt;br /&gt;
&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
[[Category:Z80 Assembly]]&lt;br /&gt;
[[Category:Z80 Heaven]]&lt;br /&gt;
[[Category:Z80 Opcodes]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>