<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=Earxtutapp1</id>
	<title>Earxtutapp1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=Earxtutapp1"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;action=history"/>
	<updated>2026-05-13T18:04:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12982&amp;oldid=prev</id>
		<title>&gt;Wongck at 15:31, 12 October 2011</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12982&amp;oldid=prev"/>
		<updated>2011-10-12T15:31:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:31, 12 October 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l214&quot;&gt;Line 214:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 214:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[ASM_Tutorial]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[ASM_Tutorial]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&quot;&gt;&lt;div&gt;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Programming&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&quot;&gt;&lt;div&gt;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Making optimized assembly code by Earx&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Wongck</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12981&amp;oldid=prev</id>
		<title>&gt;Silver Surfer: Added category</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12981&amp;oldid=prev"/>
		<updated>2009-05-02T17:07:03Z</updated>

		<summary type="html">&lt;p&gt;Added category&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:07, 2 May 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l214&quot;&gt;Line 214:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 214:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[ASM_Tutorial]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[ASM_Tutorial]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Programming]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Silver Surfer</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12980&amp;oldid=prev</id>
		<title>&gt;Zorro 2 at 08:15, 9 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12980&amp;oldid=prev"/>
		<updated>2006-10-09T08:15:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:15, 9 October 2006&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l212&quot;&gt;Line 212:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 212:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot;HI&amp;quot;      (ASCII, quotation marks)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot;HI&amp;quot;      (ASCII, quotation marks)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Back to [[ASM_Tutorial]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Zorro 2</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12979&amp;oldid=prev</id>
		<title>&gt;Simonsunnyboy at 17:51, 6 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutapp1&amp;diff=12979&amp;oldid=prev"/>
		<updated>2006-10-06T17:51:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
APPENDIX A: BITS AND BYTES&lt;br /&gt;
&lt;br /&gt;
A very important part of coding is keeping track of the required memory, be&lt;br /&gt;
it internal registers of the CPU, RAM, ROM or diskspace. In a machine&lt;br /&gt;
everything is calculated in BYTES. And these bytes consist of eight smaller&lt;br /&gt;
buggers known as bits.&lt;br /&gt;
&lt;br /&gt;
A bit can store either a 0 or a 1:&lt;br /&gt;
&lt;br /&gt;
1 bit           {0, 1}&lt;br /&gt;
                (this is two possibilities folks.. =))&lt;br /&gt;
&lt;br /&gt;
Combining two bits gives a total of 4 posibilities:&lt;br /&gt;
&lt;br /&gt;
2 bits          {00, 01, 10, 11}&lt;br /&gt;
                (2^2 = four possibilities)&lt;br /&gt;
&lt;br /&gt;
So if a byte contains 8 bits and try out all possible combinations with&lt;br /&gt;
zeroes and ones, this would give:&lt;br /&gt;
&lt;br /&gt;
byte (= 8 bits) {00000000, 00000001, 00000010, ....., 11111110, 11111111}&lt;br /&gt;
                (2^8 = 256 possibilities)&lt;br /&gt;
&lt;br /&gt;
The 680x0 series can also work with units called WORD and LONGWORD (also&lt;br /&gt;
called LONG). In the 680x0 a WORD consists of two bytes and a longword&lt;br /&gt;
consists of four bytes.&lt;br /&gt;
&lt;br /&gt;
The 680x0 can look at number in two particular ways when testing/comparing&lt;br /&gt;
values: SIGNED or UNSIGNED. In signed-mode, the highest bit in a number is&lt;br /&gt;
reserved as a SIGN indicating plus or minus.&lt;br /&gt;
&lt;br /&gt;
         +------+------+----------------+---------------------------+&lt;br /&gt;
         | UNIT | BITS | UNSIGNED RANGE |              SIGNED RANGE |&lt;br /&gt;
         +------+------+----------------+---------------------------+&lt;br /&gt;
         | BYTE |    8 |            256 |               -128 - +127 |&lt;br /&gt;
         +------+------+----------------+---------------------------+&lt;br /&gt;
         | WORD |   16 |          65536 |           -32768 - +32767 |&lt;br /&gt;
         +------+------+----------------+---------------------------+&lt;br /&gt;
         | LONG |   32 |     4294967296 | -2147483648 - +2147483647 |&lt;br /&gt;
         +------+------+----------------+---------------------------+&lt;br /&gt;
&lt;br /&gt;
Now.. If you want to store a variable that can reach values upto 320 for&lt;br /&gt;
instance (number of pixels in an ST-low screenline), you can't use a BYTE,&lt;br /&gt;
because a byte can only hold 0-255. You'd have to go for a WORD.&lt;br /&gt;
&lt;br /&gt;
Let's say you want to store a coordinate of somekind and this should be able&lt;br /&gt;
to reach from -50000 upto 50000. Then you can't fit this anymore into a WORD&lt;br /&gt;
(just look at the figure underneath SIGNED RANGE) and you'll have to settle&lt;br /&gt;
for a LONG.&lt;br /&gt;
&lt;br /&gt;
It's often the case that graphics have dimensions like 256*256 or 32*16 or&lt;br /&gt;
whatever. Why? Well.. Those values are all powers of 2.&lt;br /&gt;
&lt;br /&gt;
2^4 =  16&lt;br /&gt;
2^5 =  32&lt;br /&gt;
2^8 = 256&lt;br /&gt;
&lt;br /&gt;
See? And these values are alot easier and faster to work with compared to other&lt;br /&gt;
numbers. .....&lt;br /&gt;
&lt;br /&gt;
All units can be put through various logical operations such as AND, OR, XOR,&lt;br /&gt;
NOT and then some more. The most simplest is probably NOT: This simple inverts&lt;br /&gt;
all bits. So all ones are turned into zeroes and the other way round.&lt;br /&gt;
&lt;br /&gt;
                  00000000        01010101        00001111&lt;br /&gt;
&lt;br /&gt;
                     ||              ||              ||&lt;br /&gt;
               &amp;gt; LOGICAL NOT &amp;lt; &amp;gt; LOGICAL NOT &amp;lt; &amp;gt; LOGICAL NOT &amp;lt;&lt;br /&gt;
                     ||              ||              ||&lt;br /&gt;
                     \/              \/              \/&lt;br /&gt;
&lt;br /&gt;
                  11111111        10101010        11110000&lt;br /&gt;
&lt;br /&gt;
Unlike NOT, AND and OR require two value's as input. Because they are a bit&lt;br /&gt;
harder to comprehend we'll give some logic tables with BIT-units first.&lt;br /&gt;
&lt;br /&gt;
AND | 0 | 1                                                      OR | 0 | 1&lt;br /&gt;
----+---+---                                                     ---+---+---&lt;br /&gt;
  0 | 0 | 0                                                       0 | 0 | 1&lt;br /&gt;
----+---+---                                                     ---+---+---&lt;br /&gt;
  1 | 0 | 1                                                       1 | 1 | 1&lt;br /&gt;
&lt;br /&gt;
The AND-operation only outputs 1 if both input bits are 1, else it outputs 0.&lt;br /&gt;
You could say it requires both input1 &amp;gt;AND&amp;lt; input2 to be 1 in order to output a&lt;br /&gt;
1. The OR-operation requires only one of the input to be 1.&lt;br /&gt;
&lt;br /&gt;
Now a logical OR/AND on a unit like a byte, word, long is simply the bitwise&lt;br /&gt;
operation done for all 8/16/32 bits. This means the first bit of a byte is&lt;br /&gt;
ANDED/ORRED with the same bit in another byte.&lt;br /&gt;
&lt;br /&gt;
10101010                      00001111                     00111100&lt;br /&gt;
   \/                            \/                           \/&lt;br /&gt;
   OR====&amp;gt; 11111111              OR====&amp;gt; 00001111             OR====&amp;gt; 11111100&lt;br /&gt;
   /\                            /\                           /\&lt;br /&gt;
01010101                      00001111                     11110000&lt;br /&gt;
&lt;br /&gt;
10101010                      00001111                     00111100&lt;br /&gt;
   \/                            \/                           \/&lt;br /&gt;
  AND====&amp;gt; 00000000             AND====&amp;gt; 00001111            AND====&amp;gt; 00110000&lt;br /&gt;
   /\                            /\                           /\&lt;br /&gt;
01010101                      00001111                     11110000&lt;br /&gt;
&lt;br /&gt;
You can ofcourse do the same for words or longs.&lt;br /&gt;
&lt;br /&gt;
Ok, let's get counting with binary numbers, shall we? (&amp;quot;Why do you call me&lt;br /&gt;
count? Because I count! Bwuahahahaha!&amp;quot;.. Thanx to Rich Davey for that one =))&lt;br /&gt;
&lt;br /&gt;
In order to understand binary numbers you must first know that every bit can&lt;br /&gt;
be 0 or 1 and the 1 always refers to a unique value. The lowest (rightmost) bit&lt;br /&gt;
has value 2^0 = 1, the one after that 2^1 = 2, the next one 2^2 = 4, etc. Let's&lt;br /&gt;
write it out with an examples of a byte.&lt;br /&gt;
&lt;br /&gt;
1&lt;br /&gt;
2 6 3 1&lt;br /&gt;
8 4 2 6 8 4 2 1&lt;br /&gt;
&lt;br /&gt;
0 0 0 0 0 0 0 1 = 128*0 + 64*0 + 32*0 + 16*0 + 8*0 + 4*0 + 2*0 + 1*1 =   1&lt;br /&gt;
&lt;br /&gt;
0 0 0 0 0 0 1 0 = 128*0 + 64*0 + 32*0 + 16*0 + 8*0 + 4*0 + 2*1 + 1*0 =   2&lt;br /&gt;
&lt;br /&gt;
0 0 0 0 0 0 1 1 = 128*0 + 64*0 + 32*0 + 16*0 + 8*0 + 4*0 + 2*1 + 1*1 =   3&lt;br /&gt;
&lt;br /&gt;
....&lt;br /&gt;
&lt;br /&gt;
0 1 0 1 0 1 1 1 = 128*0 + 64*1 + 32*0 + 16*1 + 8*0 + 4*1 + 2*1 + 1*1 = 83&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
1 0 1 1 1 0 1 1 = 128*1 + 64*0 + 32*1 + 16*1 + 8*1 + 4*0 + 2*1 + 1*1 = 187&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
1 1 1 1 1 1 1 1 = 128*1 + 64*1 + 32*1 + 16*1 + 8*1 + 4*1 + 2*1 + 1*1 = 255&lt;br /&gt;
&lt;br /&gt;
We ofcouse want the option to deal with negative values as well. How do we do&lt;br /&gt;
that?&lt;br /&gt;
&lt;br /&gt;
The SIGNED and UNSIGNED numbertypes come in handy here. UNSIGNED means you can&lt;br /&gt;
only have positive values. Such like the ones, we've just dealt with. UNSIGNED&lt;br /&gt;
is the one where you use the hightest (leftmost) bit as a SIGN indicating&lt;br /&gt;
negative or positive.&lt;br /&gt;
&lt;br /&gt;
In all processors the numbers are implemented so that they can be handled as&lt;br /&gt;
SIGNED or UNSIGNED at any time. For instance the smallest negative number -1 can&lt;br /&gt;
also be seen as the highest UNSIGNED number (255 in byte, 65335 in word, etc).&lt;br /&gt;
&lt;br /&gt;
Anyway, let's give some more examples. This is how SIGNED numbers work:&lt;br /&gt;
&lt;br /&gt;
+&lt;br /&gt;
/ 6 3 1&lt;br /&gt;
- 4 2 6 8 4 2 1&lt;br /&gt;
&lt;br /&gt;
0 1 1 1 1 1 1 1 = (0*-128) + 64*1 + 32*1 + 16*1 + 8*1 + 4*1 * 2*1 1*1 = 127&lt;br /&gt;
&lt;br /&gt;
1 1 1 1 1 1 1 1 = (1*-128) + 64*1 + 32*1 + 16*1 + 8*1 + 4*1 * 2*1 1*1 = -1&lt;br /&gt;
&lt;br /&gt;
1 0 0 0 0 0 0 0 = (1*-128) + 64*0 + 32*0 + 16*0 + 8*0 + 4*0 * 2*0 1*0 = -128&lt;br /&gt;
&lt;br /&gt;
Not too much trouble to understand, is it? Adding and subtracting might be a&lt;br /&gt;
bit more difficult, but once you understand it's even easier than working with&lt;br /&gt;
decimal numbers. Every digit can only have two values as opposed to ten in&lt;br /&gt;
decimal calculus. The basis is understanding when a digit overflows. This&lt;br /&gt;
happens when the decimal digit surpasses 9 and when the binary digit surpasses&lt;br /&gt;
1. When a digit is overflown you must add 1 extra to the next digit.&lt;br /&gt;
&lt;br /&gt;
00000000&lt;br /&gt;
00000001&lt;br /&gt;
-------- +&lt;br /&gt;
00000001 (easy as pie.)&lt;br /&gt;
&lt;br /&gt;
00000001&lt;br /&gt;
00000001&lt;br /&gt;
-------- +&lt;br /&gt;
00000010 (lowest digit overflows, 1 extra is added to the next!)&lt;br /&gt;
&lt;br /&gt;
00001011&lt;br /&gt;
00000001&lt;br /&gt;
-------- +&lt;br /&gt;
00001100 (lowest digit overflows, 1 extra is added to the next, this overflows&lt;br /&gt;
          again)&lt;br /&gt;
&lt;br /&gt;
The nice thing is this operation is exactly the same for unsiged as well as&lt;br /&gt;
signed values. I could explain subtracting here as well, but I think all this&lt;br /&gt;
calculus stuff is not meant for this tutorial, but for a schoolbook.&lt;br /&gt;
&lt;br /&gt;
One more thing that used very frequently in assemblers and debuggers (as well&lt;br /&gt;
as C-- and other yech languages) is the hexadecimal notation. You might have&lt;br /&gt;
noticed binary numbers can be somewhat long to write down. You need 8 digits&lt;br /&gt;
for a byte, 16 for a word and a nasty 32 for a long. Not very nice when you&lt;br /&gt;
have to type all that into you assembler.&lt;br /&gt;
&lt;br /&gt;
The hexadecimal notation is basicly used because it is very close to our own&lt;br /&gt;
decimal notation. Every digit ranges from 0,1,2..9,a,b,c,d,e,f, so it has the a&lt;br /&gt;
bit larger range than decimal notation AND it is very easy to convert from and&lt;br /&gt;
to binary, because one digit contains exactly 4 binary digits.&lt;br /&gt;
&lt;br /&gt;
00000000 (binary) = 00 (hexadecimal)&lt;br /&gt;
11111111 (binary) = ff (hexadecimal)&lt;br /&gt;
01111111 (binary) = 7f (hexadecimal)&lt;br /&gt;
01000110 (binary) = 46 (hexadecimal)&lt;br /&gt;
&lt;br /&gt;
Also you have the ASCII notation, in which every digit (or character)&lt;br /&gt;
represents one byte with the range from 0-255. This is only nice in working&lt;br /&gt;
with textstrings.&lt;br /&gt;
&lt;br /&gt;
In motorola assembler (68K, 65xx, 56K, PPC) they are indicated like this:&lt;br /&gt;
&lt;br /&gt;
12345     (normal decimal, no extra indicator)&lt;br /&gt;
%11001100 (binary, a &amp;quot;%&amp;quot; character)&lt;br /&gt;
$1a       (hexadecimal, a dollarsign)&lt;br /&gt;
&amp;quot;HI&amp;quot;      (ASCII, quotation marks)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>&gt;Simonsunnyboy</name></author>
	</entry>
</feed>