http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&feed=atom&action=historyIntroducing the Instruction Set Part 3 - Revision history2024-03-29T12:01:00ZRevision history for this page on the wikiMediaWiki 1.30.0http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=14973&oldid=prevMr z: /* Why do we need branches? */2011-11-18T04:57:55Z<p><span dir="auto"><span class="autocomment">Why do we need branches?</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 04:57, 18 November 2011</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l46" >Line 46:</td>
<td colspan="2" class="diff-lineno">Line 46:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>That runs very fast, but it takes up a ton of ROM.  Also, it clears the screen only once.  What if you want to clear the screen many times throughout your program, perhaps from different places?  You really don't want to copy this same code everywhere you need to clear the screen.  That's where branches come in.<BR/><BR/></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>That runs very fast, but it takes up a ton of ROM.  Also, it clears the screen only once.  What if you want to clear the screen many times throughout your program, perhaps from different places?  You really don't want to copy this same code everywhere you need to clear the screen.  That's where branches come in.<BR/><BR/></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Branches tell the CPU to start executing at a different location, rather than barreling forward.  Unconditional branches and jumps tell the CPU to always jump to that location.  Conditional branches tell the CPU to jump to a new location <I>if some condition is true.</I>  These let you skip pieces of code, or repeat them a number of times.  Jumps to <del class="diffchange diffchange-inline">subroutine </del>tell the CPU "go do this and come back when you're done."  The following sections explore these concepts a little more closely.<BR/><BR/></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Branches tell the CPU to start executing at a different location, rather than barreling forward.  Unconditional branches and jumps tell the CPU to always jump to that location.  Conditional branches tell the CPU to jump to a new location <I>if some condition is true.</I>  These let you skip pieces of code, or repeat them a number of times.  Jumps to <ins class="diffchange diffchange-inline">subroutines (also known as "calls") </ins>tell the CPU "go do this and come back when you're done."  The following sections explore these concepts a little more closely.<BR/><BR/></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>= Branches and Labels =</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>= Branches and Labels =</div></td></tr>
</table>Mr zhttp://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=14938&oldid=prevMr z: /* Indirect Branches and Jump Tables */2011-07-04T07:45:28Z<p><span dir="auto"><span class="autocomment">Indirect Branches and Jump Tables</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 07:45, 4 July 2011</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l577" >Line 577:</td>
<td colspan="2" class="diff-lineno">Line 577:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>= Indirect Branches and Jump Tables =</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>= Indirect Branches and Jump Tables =</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><BLOCKQUOTE>"It was a 'Jump to Conclusions' mat. You see, it would be this mat that you would put on the floor... and would have different <B>conclusions</B> written on it that you could <B>jump to.</B>" -- Tom Smykowski, Office Space</BLOCKQUOTE></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><BLOCKQUOTE<ins class="diffchange diffchange-inline">><I</ins>>"It was a 'Jump to Conclusions' mat. You see, it would be this mat that you would put on the floor... and would have different <B>conclusions</B> written on it that you could <B>jump to.</B>"<ins class="diffchange diffchange-inline"></I> </ins>-- Tom Smykowski, Office Space</BLOCKQUOTE></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Indirect branches are branches whose destination isn't encoded into the instruction itself.  You've seen a special version of this above:  The <CODE>[[JR]] R5</CODE> and <CODE>[[PULR]] PC</CODE> sequences for returning from function calls are both forms of indirect branches.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Indirect branches are branches whose destination isn't encoded into the instruction itself.  You've seen a special version of this above:  The <CODE>[[JR]] R5</CODE> and <CODE>[[PULR]] PC</CODE> sequences for returning from function calls are both forms of indirect branches.</div></td></tr>
</table>Mr zhttp://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=14824&oldid=prevMr z: Protected "Introducing the Instruction Set Part 3" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))2010-12-04T08:42:13Z<p>Protected "<a href="/index.php/Introducing_the_Instruction_Set_Part_3" title="Introducing the Instruction Set Part 3">Introducing the Instruction Set Part 3</a>" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr style="vertical-align: top;" lang="en">
<td colspan="1" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: white; color:black; text-align: center;">Revision as of 08:42, 4 December 2010</td>
</tr><tr><td colspan="2" style="text-align: center;" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>Mr zhttp://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=14823&oldid=prevMr z at 08:42, 4 December 20102010-12-04T08:42:02Z<p></p>
<p>Can't load revision 14823</p>Mr zhttp://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10228&oldid=prev123.125.156.178: xtzPuEhatGWsZGMDqJE2010-11-21T08:42:04Z<p>xtzPuEhatGWsZGMDqJE</p>
<p>Can't load revision 10228</p>123.125.156.178http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10210&oldid=prev195.167.240.247: bOWocnCwaDnd2010-11-21T08:11:47Z<p>bOWocnCwaDnd</p>
<p>Can't load revision 10210</p>195.167.240.247http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10163&oldid=prev61.16.239.90: SqbhbZpWbODcUlIq2010-11-21T06:40:45Z<p>SqbhbZpWbODcUlIq</p>
<p>Can't load revision 10163</p>61.16.239.90http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10105&oldid=prev212.138.113.15: lCMvghuSzKIYvnOEl2010-11-21T04:51:27Z<p>lCMvghuSzKIYvnOEl</p>
<p>Can't load revision 10105</p>212.138.113.15http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10064&oldid=prev123.125.156.208: FJhhUGamvHuOWzCz2010-11-21T03:36:49Z<p>FJhhUGamvHuOWzCz</p>
<p>Can't load revision 10064</p>123.125.156.208http://wiki.intellivision.us/index.php?title=Introducing_the_Instruction_Set_Part_3&diff=10055&oldid=prev123.125.156.178: PNMPnnicmtMextG2010-11-21T03:21:02Z<p>PNMPnnicmtMextG</p>
<p>Can't load revision 10055</p>123.125.156.178