Week 1 Lecture Material
Week 1 Lecture Material
Introduction
Assembly language is the most basic programming language available for any processor. With
assembly language, a programmer works only with operations implemented directly on the
physical CPU. Assembly language lacks high-level conveniences such as variables and functions,
and it is not portable between various families of processors. Nevertheless, assembly language is
the most powerful computer programming language available, and it gives programmers the
insight required to write effective code in high-level languages. Learning assembly language is
well worth the time and effort of every serious programmer.
1.0Learning Outcome
At the end of this study session, you should be able to:
i. Explain the concept of assembly language
ii. Explain the basic elements of assembly language
iii. Discuss briefly the assembly language historical development.
2.0 Main Content
2.1 Definition of assembly language
An assembly language is a low-level programming language for computers, microprocessors,
microcontrollers, and other programmable devices in which each statement corresponds to a single
machine language instruction. An assembly language is specific to a certain computer architecture,
in contrast to most high-level programming languages, which may be more portable.
Assembly language allows the programmer to use symbolic representation for machine operation
codes (usually called mnemonics), memory locations, registers and other parts of an instruction.
A utility program called an assembler is used to translate assembly language statements into the
target computer's machine code. They are low level programming languages intended for a
computer or any other device which is programmable. Such languages are abbreviated as ‘asm’
and there is usually a very close link between the language and the machine code instructions of
the architecture. Each assembly language corresponds to only one computer – that is, there is a
high degree of specificity in case of assembly languages. This makes assembly languages quite
unlike most of the high-level languages as they cannot be used on a variety of computers whereas
high level languages are mostly portable. Assembly languages are often referred to as ‘symbolic
machine codes’.
Assembly language has several benefits, which are:
• Speed: Assembly language programs are generally the fastest programs around.
• Space: Assembly language programs are often the smallest.
• Capability: You can do things in assembly, which are difficult or impossible in high-level
languages.
• Knowledge: Your knowledge of assembly language will help you write better programs
In-text question 1
What is assembler?
In-text Answer 1:
Assembler is a utility program used to translate a program written in assembly language into
its machine language equivalent.
Assembly directives
Assembly directives, also called pseudo opcodes, pseudo-operations or pseudo-ops, are
instructions that are executed by an assembler at assembly time, not by a CPU at run time. They
tell the assembler about the various aspects of the assembly process. These are non-executable and
do not generate machine language instructions. They can make the assembly of the program
dependent on parameters input by a programmer, so that one program can be assembled different
ways, perhaps for different applications. They also can be used to manipulate presentation of a
program to make it easier to read and maintain.
(For example, directives would be used to reserve storage areas and optionally their initial
contents.) The names of directives often start with a dot to distinguish them from machine
instructions.
Symbolic assemblers let programmers’ associate arbitrary names (labels or symbols) with memory
locations. Usually, every constant and variable is given a name so instructions can reference those
locations by name, thus promoting self-documenting code. In executable code, the name of each
subroutine is associated with its entry point, so any calls to a subroutine can use its name. Inside
subroutines, GOTO destinations are given labels. Some assemblers support local symbols which
are lexically distinct from normal symbols (e.g., the use of "10$" as a GOTO destination).
Some assemblers provide flexible symbol management, letting programmers manage different
namespaces, automatically calculate offsets within data structures, and assign labels that refer to
literal values or the result of simple computations performed by the assembler. Labels can also be
used to initialize constants and variables with relocatable addresses.
Assembly languages, like most other computer languages, allow comments to be added to
assembly source code that are ignored by the assembler. Good use of comments is even more
important with assembly code than with higher-level languages, as the meaning and purpose of a
sequence of instructions is harder to decipher from the code itself.
Wise use of these facilities can greatly simplify the problems of coding and maintaining low-level
code.
In-text question 2
In-text Answer 2
Opcode mnemonics, Data sections and Assembly directives
Lamont Wood, Forgotten PC history: The true origins of the personal computer, August 8, 2008
(Computerworld),
“ASSEMBLY LANGUAGE”
https://www.cleverism.com/skills-and-tools/assembly-language/
https://en.wikipedia.org/wiki/Assembly_language
Study Session 2
Historical background of assembly language
Introduction
This study session explores the historical background of assembly language, the current usage of
assembly language and as well as the typical applications of assembly language.
1.0 Learning Outcome
At the end of this study session, you should be able to:
i. Understand the historical background of assembly language
ii. Know the current usage of assembly language
iii. Know the typical applications of assembly language.
In-text question
The Symbolic Optimal Assembly Program (SOAP) was written by who and in which year?
In-text Answer
Stan Poley in 1955.
retrieved on 2013-03-13.