http://learn.cemetech.net/index.php?title=Z80:Opcodes:SUB&feed=atom&action=historyZ80:Opcodes:SUB - Revision history2024-03-28T13:48:03ZRevision history for this page on the wikiMediaWiki 1.34.0http://learn.cemetech.net/index.php?title=Z80:Opcodes:SUB&diff=307&oldid=prevMaintenance script: Initial automated import2016-02-05T22:31:33Z<p>Initial automated import</p>
<p><b>New page</b></p><div>Sub stands for subtract but only takes one input. It subtracts the input from the accumulator and writes back to it.<br />
<br />
== Syntax ==<br />
<br />
sub op8 ;8 bit<br />
<br />
=== Allowed Instructions ===<br />
<br />
sub a<br />
sub b<br />
sub c<br />
sub d<br />
sub e<br />
sub h<br />
sub l<br />
sub n ;8 bit constant<br />
<br />
sub (hl)<br />
sub (ix+n)<br />
sub (iy+n)<br />
<br />
== Effects ==<br />
<br />
N flag set, P/V is overflow, rest modified by definition.<br />
<br />
== Uses ==<br />
<br />
Allows you to subtract two 8 bit integers. Useful in if you have an offset and want to eliminate certain items.<br />
<br />
noGood:<br />
bcall(_GetKey)<br />
sub kAdd ;get rid of all keys above add<br />
jr nc,noGood<br />
<br />
== T-States ==<br />
<br />
r denotes 8-bit register.<br />
<br />
{| class="wikitable"<br />
| r || 4 <br />
|-<br />
| X || 7 <br />
|-<br />
| (hl) || 7 <br />
|-<br />
| (ix+X) || 19 <br />
|-<br />
| (iy+X) || 19 <br />
|}<br />
<br />
== See Also ==<br />
[[Z80:Opcodes:ADC|ADC]],[[Z80:Opcodes:ADD|ADD]],[[Z80:Opcodes:DAA|DAA]],[[Z80:Opcodes:DEC|DEC]],[[Z80:Opcodes:INC|INC]],[[Z80:Opcodes:SBC|SBC]]<br />
<br />
{{lowercase}}<br />
[[Category:Z80 Assembly]]<br />
[[Category:Z80 Heaven]]<br />
[[Category:Z80 Opcodes]]</div>Maintenance script