0% found this document useful (0 votes)
57 views12 pages

Week 1 Lecture Material

Uploaded by

moses ike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views12 pages

Week 1 Lecture Material

Uploaded by

moses ike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

STUDY MODULE 1

Historical development of Assembly language.


Contents:
Study Session 1.1: Concept of assembly language
Study Session 1.2: Historical background of assembly language
Study Session 1.3: The features of assembly language and the differences between assembly
machine and high level languages.
Study Session 1
Concept of assembly language

Sections and Subsection Headings:


Introduction
1.0 Learning Outcome
2.0 Main Content
2.1 Definition of assembly language
2.2 Basic elements of assembly language design
2.3 Historical background of assembly language
3.0 Summary and Conclusion
4.0 Self-Assessment Questions
5.0 Additional Activities (Videos, Animations & Out of Class activities)
6.0 Reference/ Further Reading

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.

2.2 Basic elements of assembly language design.


There is a large degree of diversity in the way the authors of assemblers categorize statements and
in the nomenclature that they use. In particular, some describe anything other than a machine
mnemonic or extended mnemonic as a pseudo-operation (pseudo-op). A typical assembly
language consists of 3 types of instruction statements that are used to define program operations:
• Opcode mnemonics
• Data sections
• Assembly directives
Opcode mnemonics and extended mnemonics
Instructions (statements) in assembly language are generally very simple, unlike those in high-
level language. Generally, a mnemonic is a symbolic name for a single executable machine
language instruction (an opcode), and there is at least one opcode mnemonic defined for each
machine language instruction. Each instruction typically consists of an operation or opcode plus
zero or more operands. Most instructions refer to a single value, or a pair of values. Operands can
be immediate (value coded in the instruction itself), registers specified in the instruction or implied,
or the addresses of data located elsewhere in storage. This is determined by the underlying
processor architecture: the assembler merely reflects how this architecture works. Extended
mnemonics are often used to specify a combination of an opcode with a specific operand.
Extended mnemonics are often used to support specialized uses of instructions, often for purposes
not obvious from the instruction name. For example, many CPU's do not have an explicit NOP
instruction, but do have instructions that can be used for the purpose.
Data sections
There are instructions used to define data elements to hold data and variables. They define the type
of data, the length and the alignment of data. These instructions can also define whether the data
is available to outside programs (programs assembled separately) or only to the program in which
the data section is defined. Some assemblers classify these as pseudo-ops.

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

What are the basic elements of an assembly language design?

In-text Answer 2
Opcode mnemonics, Data sections and Assembly directives

3.0 Summary and Conclusion


Assembly language is a programming language that uses symbolic representations called
mnemonics to represent machine instructions. It is specific to a particular processor of any
computing devices i.e. it is not portable. Programs written in assembly requires a utility program
called assembler to translate it into an executable machine code. The assembly language design is
made up of three basic elements which are: opcode mnemonics, data sections and assembly
directives. The study of assembly language allows you to have insights about the computer
operations and also have control over some of its operations.

4.0 Self-Assessment Question


1. What is assembly language?
2. What do you understand by the word mnemonics?

5.0 Additional Activities (Videos, Animations & Out of Class activities)

Watch the following youtube videos;

Meaning of assembly language: https://www.youtube.com/watch?v=RU9XdVxffKQ

Assembly language basics: https://www.youtube.com/watch?v=y7RzEBUSmIA


6.0 Reference/ Further Reading

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

Sections and Subsection Headings:


Introduction
1.1 Learning Outcome
2.0 Main Content
2.1 Historical background of assembly language
2.2 Current Usage
2.3 Typical applications of assembly language
3.0 Summary and Conclusion
4.0 Self-Assessment Questions
5.0 Additional Activities (Videos, Animations & Out of Class activities)
6.0 Reference/ Further Reading

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.

2.0 Main Content


2.1 Historical background of assembly language
The history of assembly languages is dated back as that of the stored-program computer. When
the Electronic Delay Storage Automatic Calculator (EDSAC) was incorporated with an assembler,
‘initial orders’, which used one letter mnemonics in 1949. Stan Poley wrote the Symbolic Optimal
Assembly Program or SOAP assembly language for the IBM 650 computer in 1955.
Assembly languages started being used widely as they relieved the programmers from tedious
tasks such as remembering numeric codes. Their use, however, was reduced substantially by the
1980’s due to the introduction of high-level languages. Throughout the course of history, many
programs have been written completely in assembly language. This trend was changed with the
introduction of the Burroughs MCP in 1961, which was written in ESPOL, an Algol dialect. In
addition, many commercial applications were also written using assembly languages, such as large
amounts of IBM mainframe software.
Microcomputers, in their initial stages, depended mostly on hand-coded assembly languages. This
was due to a lack of high level language compilers meant for use on microcomputers. Another
reason for the se of assembly languages at that time was the fact that they came with many
advantages, such as minimum size, high speed, less overhead and high reliability. During this
period, many large programs were written in assembly languages, including the Lotus 1-2-3 and
IBM PC DOS operating systems. Many video games were also written in assembly languages,
even during the 1990s. The game NBA Jam, is one such game of that time (1993).
Most computers of the period 1980-90s were developed primarily using assembly languages.
Examples include the Atari ST and the MSX systems of that time. The VIC 20 system had an
assembler written by Don French and published by French Silk. Don claimed that it was the
smallest assembler ever created. The assembler supported the usual symbolic addressing and the
definition of character strings or hex strings. It also allowed address expressions which could be
combined with addition, subtraction, multiplication, division, logical AND, logical OR, and
exponentiation operators.

2.2 Current Usage


There have always been debates over the usefulness and performance of assembly language
relative to high-level languages. Assembly language has specific niche uses where it is important;
see below. But in general, modern optimizing compilers are claimed to render high-level languages
into code that can run as fast as hand-written assembly, despite the counter-examples that can be
found. The complexity of modern processors and memory sub-system makes effective
optimization increasingly difficult for compilers, as well as assembly programmers. Moreover, and
to the dismay of efficiency lovers, increasing processor performance has meant that most CPUs sit
idle most of the time, with delays caused by predictable bottlenecks such as I/O operations and
paging. This has made raw code execution speed a non-issue for many programmers.
There are some situations in which developers might choose to use assembly language:
1. A stand-alone executable of compact size is required that must execute without recourse to the
run-time components or libraries associated with a high-level language; this is perhaps the most
common situation. For example, firmware for telephones, automobile fuel and ignition systems,
air-conditioning control systems, security systems, and sensors.
2. Code that must interact directly with the hardware, for example in device drivers and interrupt
handlers.
3. Programs that need to use processor-specific instructions not implemented in a compiler. A
common example is the bitwise rotation instruction at the core of many encryption algorithms.
4. Programs that create vectorized functions for programs in higher-level languages such as C. In the
higher-level language this is sometimes aided by compiler intrinsic functions which map directly
to SIMD mnemonics, but nevertheless result in a one-to-one assembly conversion specific for the
given vector processor.
5. Programs requiring extreme optimization, for example an inner loop in a processor-intensive
algorithm. Game programmers take advantage of the abilities of hardware features in systems,
enabling games to run faster. Also large scientific simulations require highly optimized algorithms,
e.g. linear algebra with BLAS or discrete cosine transformation (e.g. SIMD assembly version from
x264)
6. Situations where no high-level language exists, on a new or specialized processor, for example.
7. Programs that needs precise timing such as
o Real-time programs such as simulations, flight navigation systems, and medical equipment.
For example, in a fly-by-wire system, telemetry must be interpreted and acted upon within
strict time constraints. Such systems must eliminate sources of unpredictable delays, which
may be created by (some) interpreted languages, automatic garbage collection, paging
operations, or preemptive multitasking. However, some higher-level languages incorporate
run-time components and operating system interfaces that can introduce such delays. Choosing
assembly or lower-level languages for such systems gives programmers greater visibility and
control over processing details.
o Cryptographic algorithms that must always take strictly the same time to execute, preventing
timing attacks.
8. Situations where complete control over the environment is required, in extremely high security
situations where nothing can be taken for granted.
9. Computer viruses, boot loaders, certain device drivers, or other items very close to the hardware
or low-level operating system.
10. Instruction set simulators for monitoring, tracing and debugging where additional overhead is kept
to a minimum
11. Reverse-engineering and modifying program files such as existing binaries that may or may not
have originally been written in a high-level language, for example when trying to recreate
programs for which source code is not available or has been lost, or cracking copy protection of
proprietary software.
12. Self-modifying code, to which assembly language lends itself well.
13. Games and other software for graphing calculators.
Assembly language is still taught in most computer science and electronic engineering programs.
Although few programmers today regularly work with assembly language as a tool, the underlying
concepts remain very important. Such fundamental topics as binary arithmetic, memory allocation,
stack processing, character set encoding, interrupt processing, and compiler design would be hard
to study in detail without a grasp of how a computer operates at the hardware level. Since a
computer's behavior is fundamentally defined by its instruction set, the logical way to learn such
concepts is to study an assembly language. Most modern computers have similar instruction sets.
Therefore, studying a single assembly language is sufficient to learn: the basic concepts, to
recognize situations where the use of assembly language might be appropriate and, to see how
efficient executable code can be created from high-level languages.

2.3 Typical applications of assembly language


i. Assembly language is typically used in a system's boot code, the low-level code that
initializes and tests the system hardware prior to booting the operating system and is often
stored in ROM.
ii. Assembly language is often used for low-level code, for instance for operating system
kernels, which cannot rely on the availability of pre-existing system calls and must indeed
implement them for the particular processor architecture on which the system will be
running.
iii. Some compilers translate high-level languages into assembly first before fully compiling,
allowing the assembly code to be viewed for debugging and optimization purposes.
iv. Some compilers for relatively low-level languages, such as Pascal or C, allow the
programmer to embed assembly language directly in the source code (so called inline
assembly). Programs using such facilities can then construct abstractions using different
assembly language on each hardware platform. The system's portable code can then use
these processor-specific components through a uniform interface.
v. Assembly language is useful in reverse engineering. Many programs are distributed only
in machine code form which is straightforward to translate into assembly language by a
disassembler, but more difficult to translate into a higher-level language through
decompiler. Tools such as the Interactive Disassembler make extensive use of disassembly
for such a purpose. This technique is used by hackers to crack commercial software, and
competitors to produce software with similar results from competing companies.
vi. Assembly language is used to enhance speed of execution, especially in early personal
computers with limited processing power and RAM.
vii. Assemblers can be used to generate blocks of data, with no high-level language overhead,
from formatted and commented source code, to be used by other code.

In-text question
The Symbolic Optimal Assembly Program (SOAP) was written by who and in which year?
In-text Answer
Stan Poley in 1955.

3.0 Summary and Conclusion


At the end of the study session, we are able to look briefly at the historical background of
assembly language, the current usage of assembly language and typical applications of the
language.
4.0 Self-Assessment Question
i. Highlight at least six (6) circumstances that might drive developers to the choice of using
assembly language program over other programs.
ii. Highlight any three typical applications of assembly language.
iii. The Burroughs MCP was written with which dialect?
5.0 Additional Activities (Videos, Animations & Out of Class activities)

Follow the link to learn basic history of assembly language:


https://www.youtube.com/watch?v=wigkOTDVVLM

6.0 Reference/ Further Reading


https://en.wikipedia.org/wiki/Assembly_language
http://www.computerworld.com/s/article/print/9111341/Forgotten_PC_history_The_true_origins
_of_the_personal_computer

retrieved on 2013-03-13.

You might also like