<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Talk Binary &#187; LC-3</title>
	<atom:link href="http://talkbinary.com/category/programming/lc-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://talkbinary.com</link>
	<description>Programming Resources, Technology, Computers</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:01:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>LC-3 Operations</title>
		<link>http://talkbinary.com/programming/lc-3/lc-3-operations/</link>
		<comments>http://talkbinary.com/programming/lc-3/lc-3-operations/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 23:17:52 +0000</pubDate>
		<dc:creator>Diego</dc:creator>
				<category><![CDATA[LC-3]]></category>
		<category><![CDATA[ADD]]></category>
		<category><![CDATA[AND]]></category>
		<category><![CDATA[Destination]]></category>
		<category><![CDATA[LC-3 Operations]]></category>
		<category><![CDATA[NOT]]></category>
		<category><![CDATA[Registers]]></category>
		<category><![CDATA[Truth Tables]]></category>

		<guid isPermaLink="false">http://talkbinary.com/?p=1247</guid>
		<description><![CDATA[LC-3 has three type of operations: ADD, AND, and NOT. I&#8217;ll describe them below with an accompanying Truth Table if necessary. *Note: I&#8217;ll be accompanying this with an intro to the LC-3 Programming Environment soon&#8230;This was merely posted for those who needed help with their CS course. I&#8217;ll post the remaining guides soon&#8230; First of<a class="moretag" href="http://talkbinary.com/programming/lc-3/lc-3-operations/">&#160;&#160;Full Article&#8230;</a>
]]></description>
			<content:encoded><![CDATA[<p>LC-3 has three type of operations: ADD, AND, and NOT. I&#8217;ll describe them below with an accompanying Truth Table if necessary.</p>
<p>*Note: I&#8217;ll be accompanying this with an intro to the LC-3 Programming Environment soon&#8230;This was merely posted for those who needed help with their CS course. I&#8217;ll post the remaining guides soon&#8230;</p>
<p>First of all before we begin, let&#8217;s say these registers hold the following values&#8230;</p>
<p>R2 = 10<br />
R3 = 15<br />
R4 = 1;</p>
<h3 id="section-1">The ADD Operation</h3>
<p>The first ADD operation allows you to add the content of two registers and save the result in a register.</p>
<pre lang="">ADD	R2, R3, R4</pre>
<p>R2 denotes the Destination Register<br />
R3, and R4 denotes the Registers whose contents will be added</p>
<p><b>Translation:</b><br />
R2 = R3 + R4<br />
R2 = 15 + 1<br />
R2 would contain 16.</p>
<pre lang="">ADD	R2, R3, immediate value</pre>
<p><span id="more-1247"></span><br />
R2 denotes the Destination Register<br />
R3 is the register whose contents will be added to an immediate value (can you determine the value of the highest/lowest value that can be represented here?) You can place values such as 5, 10, 0, -2, -5&#8230;so on</p>
<p><b>Translation with Example:</b><br />
R2 = R3 + 10;<br />
R2 = 15 + 10;<br />
R2 = 25;</p>
<h3 id="section-2">The AND Operation</h3>
<p> The <b>truth table</b> for the AND operation between two binary digits is below. Easiest way to remember, is simply to know that in order to get TRUE or 1, all contents that are ANDed must be 1 or TRUE.</p>
<table border="1">
<tr>
<td>A</td>
<td>B</td>
<td>A AND B</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</table>
<pre lang="">AND	R2, R3, R4</pre>
<p>R2 is the Destination Register<br />
R3 and R4 are the Registers whose contents will be ANDed</p>
<p><b>Translation:</b><br />
R2 = R3 AND R4;<br />
R2 = 1111 AND 0001<br />
R2 = 0001</p>
<pre lang="">AND	R2, R3, immediate value</pre>
<p>R2 is the Desination Register<br />
R3 is the register whose contents will be ANDed with an immediate value</p>
<p><b>Translation</b>:<br />
R2 = R3 AND 5;<br />
R2 = 1111 AND 0101<br />
R2 = 0101</p>
<h3 id="section-3">The NOT Operation</h3>
<p>The <b>truth table</b> for the NOT Operation is below. To remember, simply invert the bits whenever you see a NOT operation.</p>
<table border="1">
<tr>
<td>A</td>
<td>NOT A</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
</tr>
</table>
<pre lang="">NOT	R1, R4</pre>
<p>R1 is the Destination Register<br />
R2 is the register whose contents will be NOT</p>
<p><b>Translation:</b><br />
R1 = NOT R4<br />
R1 = NOT 0001<br />
R1 = 1110</p>
<h3 id="section-4">Summary</h3>
<p>It is critical for you to understand how these instructions operate fully. I&#8217;ll be adding Data Movement, Control, and Trapvector table instructions soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://talkbinary.com/programming/lc-3/lc-3-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: talkbinary.com @ 2012-02-12 01:58:56 -->
