Introduction to Assembly Language
Central Processing Unit (CPU)
Control Unit is device which "runs" the CPU.
ALU-arithmetic/logic unit does the arithmetic and logic.
Main Memory stores everything.
Conceptually like a very long strip of memory locations.
Each location holds a 0 or a 1 called a bit = binary
8 bits = 1 byte, 2 bytes = 1 word, 2 words = 1 double word
Each byte (or word) has an address and can be accessed directly, i.e. RAM
- random access memory.
Everthing, i.e. instructions, data, software must be stored in main memory.
The only language that is ever actually executed by a computer.
Composed of instructions encoded as strings of 0's and 1's.
Never written and rarely read directly by programmers.
Programmers write in Assembly Language. It uses mnemonics,
eg. instead of 110001011 there is ADD
1-1: One assembly language instruction corresponds to one machine language
(Exception: "synthetic instructions" or "pseudo instructions" may translate
into a more than one machine language instruction. Also special input/output
instructions save much programming time.)
The Assembler (a program) translates assembly code into machine
Assembler language is just a more readable version of machine language
(machine language in symbolic form instead of binary form).
You write Assembly code; Assembler translates it into machine code; Control
unit runs machine code.
High-Level Languages (Pascal, C, Java, Prologue etc.):
Assembly language is still tedious to work in so most work done in HLL.
Translated into machine language by a Compiler (sometimes an intermediate
One-to-many: One HLL statement tranlates into several or several dozen
of machine instructions.
Much more abstract and compact.
Compilers translate evything at once and only once. Interpreters
translate one statement at a time and every time a statement is encountered,
eg. a loop, it must be translated from scratch.
Computers are very complex like human body.
To study them you study one layer at a time (like peeling an onion one
skin at a time).
There are more layers but we do the last four, one at a time.
You will be lied to because of simplifications,mistakes, convenience of
Why USE Assembly language?
Old reason: To get very efficient code in time-critical places. No
longer true. Compilers generate better code than almost all assebly
language programmers. Because of hardware improvements, this
kind of speed is mostly redundant.
Valid Reason: Need access to specific hardware features or instructions,
eg. set interrupt level in state register - cannot be done in any HLL.
This occurs in system programming and is implemented via assembly language
subprograms. Also programmers contolling physical objects eg. robots,
programm in assembly language.
OK, then, Why STUDY Assembly Language?
Needed for a full understanding of HLLs and the reason for some of their
Needed in order to write many programs well (to understand efficiency
issues) especially in parallel computers.
Needed to write or understand compilers, interpreters, debuggers.
The basis for understanding computer hardware and computer organization
To be a "Computer Scientist": This is the way ALL software runs and what
ALL hardware has as its core function.
We will study
Motorola 68000 and Sparc to compare and contrast major paradyms in assemblers.
We will not study MAS directly as incorrect programs tend to crash the
MAC and be inconvenient. Instead we will use a 68000 simulater.
Like all simulators, this one is slightly different from MAS and its I/O
is primitive but it is easy to use, can be downloaded for free onto home
computers and is suppose to be available on MHnet.
The SPARC assembly language we will get from CCU. The CC compiler
understands it as well as C.
Strings of 0's and 1's.
Many different ways to represent integers, real numbers and characters.
In Ford & Topp 1-23,59-72. But you must know number systems and
specfically how to change from one number sytem to another one. Eg.
You must know algorithms to change 1367=6A12.