<?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%3AAnswers_4</id>
	<title>Z80:Answers 4 - 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%3AAnswers_4"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Answers_4&amp;action=history"/>
	<updated>2026-04-28T22:35:38Z</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:Answers_4&amp;diff=141&amp;oldid=prev</id>
		<title>KermMartian: Created page with &quot;1. Because using bitwise AND on a set bit doesn&#039;t change anything, this operation will preserve the byte as it is. However, it will modify the flags, thoug...&quot;</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Answers_4&amp;diff=141&amp;oldid=prev"/>
		<updated>2016-02-05T07:35:17Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;1. Because using bitwise &lt;a href=&quot;/index.php/Z80:Opcodes:AND&quot; title=&quot;Z80:Opcodes:AND&quot;&gt;AND&lt;/a&gt; on a set bit doesn&amp;#039;t change anything, this operation will preserve the byte as it is. However, it will modify the flags, thoug...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;1. Because using bitwise [[Z80:Opcodes:AND|AND]] on a set bit doesn&amp;#039;t change anything, this operation will preserve the byte as it is. However, it will modify the flags, though not usefully.&lt;br /&gt;
&lt;br /&gt;
2. Note: these are not the only ways to set/reset the z flag, nor are they the best or even close to good.&lt;br /&gt;
&lt;br /&gt;
    ;set z flag&lt;br /&gt;
    xor a&lt;br /&gt;
    &lt;br /&gt;
    ;reset z flag&lt;br /&gt;
    set 0,a&lt;br /&gt;
    or a&lt;br /&gt;
&lt;br /&gt;
3. The very idea behind &amp;quot;XAND&amp;quot; is an oxymoron. The exclusive means that only one is true, but the AND means that both must be true, so there is no possible way for this instruction to exist.&lt;br /&gt;
&lt;br /&gt;
4. Oops, this leaves all the bits unchanged instead of resetting. To reset all the bits, use [[Z80:Opcodes:AND|AND]] 0.&lt;br /&gt;
&lt;br /&gt;
5. Oops, should have used [[Z80:Opcodes:RES|RES]].&lt;br /&gt;
&lt;br /&gt;
6. [[Z80:Opcodes:XOR|XOR]] A will always set the z flag, so you&amp;#039;re stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    loop:&lt;br /&gt;
    ;...&lt;br /&gt;
    ;Operations that do something with z flag. We want to keep looping if z flag is set&lt;br /&gt;
    ;...&lt;br /&gt;
     xor a        ;set the accumulator to zero&lt;br /&gt;
     jr z,loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
[[Category:Z80 Assembly]]&lt;br /&gt;
[[Category:Z80 Heaven]]&lt;/div&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
</feed>