<?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=Earxtutchap0</id>
	<title>Earxtutchap0 - 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=Earxtutchap0"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutchap0&amp;action=history"/>
	<updated>2026-05-13T17:07:15Z</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=Earxtutchap0&amp;diff=12998&amp;oldid=prev</id>
		<title>&gt;Wongck at 15:29, 12 October 2011</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutchap0&amp;diff=12998&amp;oldid=prev"/>
		<updated>2011-10-12T15:29:54Z</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:29, 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-l332&quot;&gt;Line 332:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 332:&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=Earxtutchap0&amp;diff=12997&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=Earxtutchap0&amp;diff=12997&amp;oldid=prev"/>
		<updated>2009-05-02T17:08:44Z</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:08, 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-l332&quot;&gt;Line 332:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 332:&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=Earxtutchap0&amp;diff=12996&amp;oldid=prev</id>
		<title>&gt;Zorro 2 at 08:06, 9 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutchap0&amp;diff=12996&amp;oldid=prev"/>
		<updated>2006-10-09T08:06:15Z</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:06, 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-l330&quot;&gt;Line 330:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 330:&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;                         assemble your program.&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;                         assemble your program.&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=Earxtutchap0&amp;diff=12995&amp;oldid=prev</id>
		<title>&gt;Simonsunnyboy at 17:44, 6 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Earxtutchap0&amp;diff=12995&amp;oldid=prev"/>
		<updated>2006-10-06T17:44:35Z</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;
                           CHAPTER 0 : ASSEMBLER?&lt;br /&gt;
&lt;br /&gt;
Right! For those of you that don't even know what assembler is I'm going to&lt;br /&gt;
explain briefly what it's all about. For more experienced people, see the&lt;br /&gt;
introduction. For people who can already code alot of stuff: Completely ignore&lt;br /&gt;
the first three chapters!&lt;br /&gt;
&lt;br /&gt;
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . &lt;br /&gt;
&lt;br /&gt;
You might be using your Atari like any normal person. Just doing the normal &lt;br /&gt;
things to get the electrons flowing in your Atari's wires. Using the occasional&lt;br /&gt;
tool, playing games and watching demos.&lt;br /&gt;
&lt;br /&gt;
Ofcourse you understand things like videomodes, RAM, ROM, disks, samples and&lt;br /&gt;
so forth. But have you ever wondered for instance how the screen is brought&lt;br /&gt;
from your atari to your screen? Or how a sprite is stored in memory and&lt;br /&gt;
how it is blitted?&lt;br /&gt;
&lt;br /&gt;
Before starting to code in any language (let alone assembler) one should &lt;br /&gt;
understand the basics of how an atari works. And so we start off with a&lt;br /&gt;
(immensely, hugely, completely) simplified schematic of your trusty old&lt;br /&gt;
machine.&lt;br /&gt;
&lt;br /&gt;
                   +---------+           +----------+&lt;br /&gt;
                   | display |           | controls |&lt;br /&gt;
                   +---------+           +----------+&lt;br /&gt;
                        ^                     v &lt;br /&gt;
                  +-----------+   +-----+  +------+&lt;br /&gt;
                  | videochip |&amp;lt;--| RAM |  | IKBD |&lt;br /&gt;
                  +-----------+   +-----+  +------+&lt;br /&gt;
                        ^            ^         ^&lt;br /&gt;
       . . . . . . . . .|. . . . . . | . . . . | . . . . . . . .&lt;br /&gt;
       b u s   b u s    |    b u s   |   b u s |   b u s   b u s&lt;br /&gt;
       . . . . . . . . .|. . . . . . | . . . . | . . . . . . . .&lt;br /&gt;
                        |            v         |&lt;br /&gt;
                        |         +-----+      |&lt;br /&gt;
                        +--------&amp;gt;| CPU |&amp;lt;-----+&lt;br /&gt;
                                  +-----+&lt;br /&gt;
&lt;br /&gt;
There it is.. An ST without sounds or any peripherals except video and&lt;br /&gt;
controls (basics of a modern computer). Ofcourse the CPU (in this case the&lt;br /&gt;
68K) is the heart of the whole thing. It can read from the controls (mouse,&lt;br /&gt;
joystick, keyboard), read/write from/to RAM and send commands to the various&lt;br /&gt;
chips.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CPU&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Very shocking, I agree completely =) The important thing is that the CPU&lt;br /&gt;
is PROGRAMMABLE. This means it can execute little commands (copying bytes,&lt;br /&gt;
calculating little arithmetic, etc.) and can execute these in sequence,&lt;br /&gt;
repeat and even execute them depending on condition codes. If you have ever&lt;br /&gt;
written some basic you understand what this means.&lt;br /&gt;
&lt;br /&gt;
In assembler, when you're working on the lowest possible level, you can imagine&lt;br /&gt;
that you can't do a whole lot of things with one command (= &amp;quot;instruction&amp;quot;&lt;br /&gt;
in assembler terms). You can typically copy small portions of memory or&lt;br /&gt;
do a addition or mulitplication.&lt;br /&gt;
&lt;br /&gt;
Anyway.. The CPU reads these little instructions from RAM or ROM. Typicly&lt;br /&gt;
these instructions are very small.. 2 upto 12 bytes depending on their&lt;br /&gt;
purpose.&lt;br /&gt;
&lt;br /&gt;
So the CPU uses the RAM to get it's program and to buffer too. In both cases&lt;br /&gt;
a whole bunch of wires spanning the motherboard are needed. These are called&lt;br /&gt;
the:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BUS&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The bus is needed to get things from chip to ram and the other way round.&lt;br /&gt;
If for instance the videochip wants to read some bytes to transform into&lt;br /&gt;
signals for the monitor it requests data from a specific ADDRESS. It sends&lt;br /&gt;
this request to the bus and the bus returns the data.&lt;br /&gt;
&lt;br /&gt;
The same thing goes for the CPU wanting to access a piece of RAM or even to&lt;br /&gt;
send/receive to/from codes the video or ikbd. Sometimes chips have registers&lt;br /&gt;
for access on the bus. These are called hardware registers. These toghether&lt;br /&gt;
with all accessible RAM and ROM form the MEMORYMAP. Every byte in this map&lt;br /&gt;
has it's own unique 32bit address.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;VIDEOCHIP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned above it can read from RAM, which means the videomemory is&lt;br /&gt;
located in the main RAM and is accessible from the CPU as well. The ST&lt;br /&gt;
videochip reads it's data in a quite awkard manner which is described in&lt;br /&gt;
chapter 2.&lt;br /&gt;
&lt;br /&gt;
Also this chip has got shiftmode and palette hardwareregisters, which means&lt;br /&gt;
you can send information to it as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IKBD&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Has a few hardware registers for access. It reads from the keyboard and puts&lt;br /&gt;
scancodes and movements in it's register. It can be commanded from the CPU&lt;br /&gt;
by accessing a controlregister. This means you can alter the way mouse/&lt;br /&gt;
joystick information is sent.&lt;br /&gt;
&lt;br /&gt;
Now you know that the CPU can control all major building blocks in the atari.&lt;br /&gt;
Equally important is the fact is that it can run a complex program with&lt;br /&gt;
sequencing, repetition and selection.&lt;br /&gt;
&lt;br /&gt;
How to program this CPU? The asnwer is putting a sequence of instructions&lt;br /&gt;
in RAM where the CPU will read. And what better way to do this than with&lt;br /&gt;
the thing closest to putting the bytes in there by hand -&amp;gt; ASSEMBLER!&lt;br /&gt;
&lt;br /&gt;
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . &lt;br /&gt;
&lt;br /&gt;
First, you need a program called an assembler. Appendix D lists alot of these&lt;br /&gt;
and you're free to choose whatever one you like best. I still use DEVPAC 3.1.&lt;br /&gt;
In my eyes the best one so far.&lt;br /&gt;
&lt;br /&gt;
A complete assembler package consists off:&lt;br /&gt;
&lt;br /&gt;
* An editor: just a stupid screen your type your code into, and allows to load,&lt;br /&gt;
  save and use blockfunctions, etc.&lt;br /&gt;
* An assembler: Actually &amp;quot;assembles&amp;quot; (cool word, isn't it =)) the sourcecode&lt;br /&gt;
  you typed in to a nice PRG or TOS program.&lt;br /&gt;
* A debugger: Doesn't actually automaticly remove bugs from your code, but you&lt;br /&gt;
  can go through your code step by step to see what happend exactly. A debugger&lt;br /&gt;
  is also called a monitor.&lt;br /&gt;
&lt;br /&gt;
You can begin with starting up the package. Then typing in some crap in a new&lt;br /&gt;
sourcefile. You need to understand the basic format of the assembler language.&lt;br /&gt;
Every line in assembler consists of fields. As you can see in the ASCII drawing&lt;br /&gt;
below, there can be four. Field are separated by spaces or tabs (easier).&lt;br /&gt;
&lt;br /&gt;
labels  instr   param   comments&lt;br /&gt;
|       |       |       |&lt;br /&gt;
v       v       v       v&lt;br /&gt;
label:  move.l  d0,d1   * Moves d0 into d1.&lt;br /&gt;
        move.l  d0,d2   * Moves d0 into d2.&lt;br /&gt;
&lt;br /&gt;
The beginning of everyline can be filled up with a label. Simply a name to give&lt;br /&gt;
a certain part of te code. This is optional, you can also type in a tab or a&lt;br /&gt;
few spaces. After having typed that you must type the instructionfield. Take a&lt;br /&gt;
look at appendix B for a complete list of all possible instructions.&lt;br /&gt;
&lt;br /&gt;
The next field is the parameterfield for the instruction. Some instructions like&lt;br /&gt;
&amp;quot;rts&amp;quot;, &amp;quot;nop&amp;quot;, &amp;quot;reset&amp;quot; don't require any parameters. Some require 1 and some 2.&lt;br /&gt;
Parameters can be so-called CPU-registers, addresses, and pointers. Which&lt;br /&gt;
parameters can be used, depends on the used instruction. Parameters are&lt;br /&gt;
seperated by &amp;quot;,&amp;quot; characters.&lt;br /&gt;
&lt;br /&gt;
A asterisk &amp;quot;*&amp;quot; or &amp;quot;;&amp;quot; semicolon indicates the following characters in the line&lt;br /&gt;
are comment and should not be assembled.&lt;br /&gt;
&lt;br /&gt;
Now, for our very first program. Type in the following:&lt;br /&gt;
&lt;br /&gt;
        clr.w   -(sp)                   * Code 0: Pterm: Terminate program.&lt;br /&gt;
        trap    #1                      * Call OS to do call.&lt;br /&gt;
&lt;br /&gt;
And find the &amp;quot;assemble&amp;quot; option in your package. Once it has assembled the&lt;br /&gt;
sourcecode into a PRG-file you can also run it. Search for the run option and&lt;br /&gt;
use it.&lt;br /&gt;
&lt;br /&gt;
This program should do nothing more than return to the assembly package. Cool,&lt;br /&gt;
eh? ;-) Not very stunning or anything, but what did you expect from 2 lines&lt;br /&gt;
code? =)&lt;br /&gt;
&lt;br /&gt;
Now you do however know to basic steps to make a program:&lt;br /&gt;
&lt;br /&gt;
1) Edit the sourcecode.&lt;br /&gt;
2) Assemble it.&lt;br /&gt;
3) Run it.&lt;br /&gt;
&lt;br /&gt;
Now for some small excersizes with some basic instructions and explaining what&lt;br /&gt;
these instructions actually do. But before this let's explain the registers of&lt;br /&gt;
the 680x0 CPU.&lt;br /&gt;
&lt;br /&gt;
d0 to d7: 32bits (=LONGWORD) data registers. Most number crunching instructions&lt;br /&gt;
          can only have them as parameters. You can also use the low-word (=&lt;br /&gt;
          the lower 16 bits), or the low-byte of the registers for&lt;br /&gt;
          instructions. Registers can hold integer numbers, fixed point&lt;br /&gt;
          fractional numbers, characters, bitfields, etc.&lt;br /&gt;
a0 to a6: 32bits address registers. These can be filled with an address that&lt;br /&gt;
          points to a byte/word/longword in RAM. Most C-users (blech!! =))&lt;br /&gt;
          would call these pointers. Most number crunching instructions don't&lt;br /&gt;
          work with these. It's only possible to copy and add/subtract with&lt;br /&gt;
          address registers. And ofcourse use them for what they are designed to&lt;br /&gt;
          do: fetch data, store data to the position they point to.&lt;br /&gt;
a7 (sp):  Address register nr. 7 is also an address register, but this time&lt;br /&gt;
          it's used as a so called &amp;quot;StackPointer&amp;quot;. A register that points to a&lt;br /&gt;
          stack of data. You can put data on the stack and you can get it off&lt;br /&gt;
          the stack again. See it as a pile of little blocks.&lt;br /&gt;
&lt;br /&gt;
The most basic instructions:&lt;br /&gt;
&lt;br /&gt;
* move: moves data from one operand to the other.&lt;br /&gt;
&lt;br /&gt;
        move.w  #1,d0                   * Copy number 1 into the lowword of d0.&lt;br /&gt;
        move.w  d0,d1                   * Copy contents of d0 lowword in d1.&lt;br /&gt;
        move.l  d1,d2                   * Copy longword d1 to d2.&lt;br /&gt;
        move.b  (a0),d0                 * Fetch byte from RAM where a0 points&lt;br /&gt;
                                        * and put it in d0 lowbyte.&lt;br /&gt;
        move.l  d0,a0                   * Copy d0 longword to a0.&lt;br /&gt;
        move.b  d2,(a0)                 * Store d2 low byte in RAM where a0&lt;br /&gt;
                                        * points.&lt;br /&gt;
&lt;br /&gt;
* add: adds one operand to the other.&lt;br /&gt;
&lt;br /&gt;
        add.w   #1,d0                   * Add 1 to d0 lowword.&lt;br /&gt;
        add.w   d0,d1                   * Add d0 to d1 lowword.&lt;br /&gt;
        add.w   (a2),d0                 * Fetch word from RAM where a2 points.&lt;br /&gt;
                                        * and add it from d0 lowword.&lt;br /&gt;
&lt;br /&gt;
* sub: subtracts one operand from the other (big suprise there! =)).&lt;br /&gt;
&lt;br /&gt;
        sub.w   #1,d0                   * Subtract 1 to d0 lowword.&lt;br /&gt;
        sub.w   d0,d1                   * Subtract d0 to d1 lowword.&lt;br /&gt;
        sub.w   (a2),d0                 * Fetch word from RAM where a2 points&lt;br /&gt;
                                        * and subtract it from d0 lowword.&lt;br /&gt;
&lt;br /&gt;
You might have noticed the instruction field can often have a point with a &amp;quot;b&amp;quot;&lt;br /&gt;
(byte), &amp;quot;w&amp;quot; (word) or &amp;quot;l&amp;quot; (longword) attached to it. This denotes the size of&lt;br /&gt;
the parameters. Some instructions can have only one size and don't need this&lt;br /&gt;
attachment.&lt;br /&gt;
&lt;br /&gt;
What do all these instructions do? The basis of coding assembler is knowing&lt;br /&gt;
every detail of an instruction. Let's explain sizes and addressingmodes a bit&lt;br /&gt;
further with examples:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; register move.w&lt;br /&gt;
&lt;br /&gt;
* before: d0 = 12345&lt;br /&gt;
*         d1 =     0&lt;br /&gt;
&lt;br /&gt;
        move.w  d0,d1                   * Copy d0 word to d1.&lt;br /&gt;
&lt;br /&gt;
* after:  d0 = 12345&lt;br /&gt;
*         d1 = 12345&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; register add.w&lt;br /&gt;
&lt;br /&gt;
* before: d0 = 12345&lt;br /&gt;
&lt;br /&gt;
        add.w   #1,d0                   * Add 1 to d0 word.&lt;br /&gt;
&lt;br /&gt;
* after:  d1 = 12346&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; register sub.w&lt;br /&gt;
&lt;br /&gt;
* before: d0 = 12345&lt;br /&gt;
&lt;br /&gt;
        sub.w   #1,d0                   * Subtract 1 from d0 word&lt;br /&gt;
&lt;br /&gt;
* after:  d0 = 12344&lt;br /&gt;
&lt;br /&gt;
Here, all instructions are pretty straightforward. They only use immediate- and&lt;br /&gt;
register addressingmodes and one size (word). For smaller numbers you can also&lt;br /&gt;
use bytes. For larger numbers than 65535 you must use longwords. For more info&lt;br /&gt;
you can check out appendix A.&lt;br /&gt;
&lt;br /&gt;
Ofcourse you can also work with the memory. The most basic instruction for&lt;br /&gt;
working with the memory is again the &amp;quot;move&amp;quot; instruction:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; memory word load&lt;br /&gt;
&lt;br /&gt;
* before: d0:     0&lt;br /&gt;
*         a0:  1234&lt;br /&gt;
*         memory at address 1234: 22222&lt;br /&gt;
&lt;br /&gt;
        move.w  (a0),d0                 * Load one word from memory to d0.&lt;br /&gt;
&lt;br /&gt;
* after:  d0: 22222&lt;br /&gt;
*         a0:  1234&lt;br /&gt;
*         memory at address 1234: 22222&lt;br /&gt;
&lt;br /&gt;
As you can see the addressregister a0 has a value that points to a certain&lt;br /&gt;
location in the memory. This value is also known as an &amp;quot;address&amp;quot;. Hence&lt;br /&gt;
&amp;quot;addressingmodes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; memory word store&lt;br /&gt;
&lt;br /&gt;
* before: d0: 11111&lt;br /&gt;
*         a0:  1234&lt;br /&gt;
*         memory at address 1234: 0&lt;br /&gt;
&lt;br /&gt;
        move.w  d0,(a0)                 * Store one word from d0 to memory.&lt;br /&gt;
&lt;br /&gt;
* after:  d0: 11111&lt;br /&gt;
*         a0:  1234&lt;br /&gt;
*         memory at address 1234: 11111&lt;br /&gt;
&lt;br /&gt;
As you can see you can use every register you have with these instructions.&lt;br /&gt;
That's part of the 68000 architecture. So an operation on d0 will also work on&lt;br /&gt;
d1, d2,..., d7. The same goes for a0..a6 (a7 is a special one..).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, what to do with all the calculation instructions? Read all about that in&lt;br /&gt;
Chapter 2.&lt;br /&gt;
&lt;br /&gt;
The summary:&lt;br /&gt;
&lt;br /&gt;
Address:                A place in the memorymap where data can be accessed.&lt;br /&gt;
Addressingmode:         An instruction can have one or more addressingmodes.&lt;br /&gt;
                        An instruction can for instance only work with&lt;br /&gt;
                        dataregisters or immediate data (data is contained by&lt;br /&gt;
                        the instruction itself). Some addressingmodes can use&lt;br /&gt;
                        data from memoryaddresses too or even have complex&lt;br /&gt;
                        indexing functionality.&lt;br /&gt;
Assembler:              Assembles your sourcecode into an executable program.&lt;br /&gt;
Comment:                In your sourcecode a commented line (always skipped by&lt;br /&gt;
                        the assembler) is denoted by putting a &amp;quot;;&amp;quot; at the&lt;br /&gt;
                        beginning of the line. Most assemblers also support the&lt;br /&gt;
                        asterisk &amp;quot;*&amp;quot;.&lt;br /&gt;
Debugger:               Allows you to step through your programfile and run&lt;br /&gt;
                        and skip certain parts of the code to pinpoint the&lt;br /&gt;
                        bugs.&lt;br /&gt;
Editor:                 You type your sourcecode with this program. Good&lt;br /&gt;
                        editors offer easy cooperation with the assembler and&lt;br /&gt;
                        the debugger.&lt;br /&gt;
Instruction:            A code that defines a specific operation the CPU can&lt;br /&gt;
                        execute. One instruction typed in your editor is always&lt;br /&gt;
                        one line of text, never more. Assembled it can be 2&lt;br /&gt;
                        upto 16 bytes.&lt;br /&gt;
Memorymap:              The memorymap is basicly all RAM, ROM and hardware-&lt;br /&gt;
                        registers. Try to see it as a large street where every&lt;br /&gt;
                        house has an address and can contain RAM, ROM or a&lt;br /&gt;
                        hardware register.&lt;br /&gt;
Operand:                A parameter for the instruction. An operand can be a&lt;br /&gt;
                        data/address register or a memoryaddress or immediate&lt;br /&gt;
                        data, etc.&lt;br /&gt;
OS Call:                A call to the Operating System. The program can can call&lt;br /&gt;
                        the OS to execute a specific task.&lt;br /&gt;
Registers:              The internal data/address registers of your CPU. These&lt;br /&gt;
                        are small and directly accessible dataunits used when&lt;br /&gt;
                        instructions are executed.&lt;br /&gt;
Sourcecode:             Textfile(s) and complementary datafiles needed to&lt;br /&gt;
                        assemble your program.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>&gt;Simonsunnyboy</name></author>
	</entry>
</feed>