Sei sulla pagina 1di 34

INTRODUCTION TO

ASSEMBLY LANGUAGE
Evolution and History of
Programming Languages
Programming Language
- a set of word and rules to construct
structures with which to express and process
information for handling computers and
associated equipment.
- a vocabulary and set of grammatical rules
for instructing a computer to perform specific
tasks
History Timeline
Machine languages
Assembly languages
Higher-level languages
To build programs, people use languages that are
similar to human language. The results are translated
into machine code, which computers understand.
Programming languages fall into three broad
categories/levels:
The Evolution of Programming Languages
Machine languages (first-generation languages) are
the most basic type of computer languages,
consisting of strings of numbers the computer's
hardware can use.
Different types of hardware use different machine
code. For example, IBM computers use different
machine language than Apple computers.
The Evolution of Programming Languages -
Machine Languages
Assembly languages (second-generation languages)
are nothing more than a symbolic representation of
machine code, which also allows symbolic designation
of memory locations. Somewhat easier to work with
than machine languages.
To create programs in assembly language, developers
use cryptic English-like phrases(mnemonic codes) to
represent strings of numbers.
The code is then translated into object code, using a
translator called an assembler.
The Evolution of Programming Languages -
Assembly Languages
Assembler
Assembly
code
Object code
Third-generation languages
Fourth-generation languages
Fifth-generation languages
Higher-level languages are more powerful than
assembly language and allow the programmer to
work in a more English-like environment.
Higher-level programming languages are divided into
three "generations," each more powerful than the
last:
The Evolution of Programming Languages -
Higher-Level Languages
FORTAN C
COBOL C++
BASIC Java
Pascal ActiveX
Third-generation languages (3GLs) are the first to
use true English-like phrasing, making them easier
to use than previous languages.
3GLs are portable, meaning the object code
created for one type of system can be translated
for use on a different type of system.
The following languages are 3GLs:
Higher-Level Languages -
Third-Generation Languages
A Typical C Program Development Environment
1. Edit
2. Preprocess
3. Compile
4. Link
5. Load
6. Execute
Disk
Disk
Loader
Linker
Compiler
Preprocessor
Editor
Disk
Disk
Disk
Primary Memory
CPU
Primary Memory
1. Program is created in the
editor and stored on disk
2. Preprocessor program
processes the code
3. Compiler creates object
code and stores it on disk.
5. Loader puts program
in memory.
4. Linker links the object
code with the libraries
6. CPU takes each instruction
and executes it, possibly
storing new data values as
the program executes
Phases of C Programs:
Visual Basic (VB)
VisualAge
Authoring environments
Fourth-generation languages (4GLs) are even
easier to use than 3GLs.
4GLs may use a text-based environment (like a
3GL) or may allow the programmer to work in a
visual environment, using graphical tools.
The following languages are 4GLs:
Higher-Level Languages -
Fourth-Generation Languages
Fifth-generation languages (5GLs) are an issue of
debate in the programming community some
programmers cannot agree that they even exist.
These high-level languages would use artificial
intelligence to create software, making 5GLs
extremely difficult to develop.
Solve problems using constraints rather than
algorithms, used in Artificial Intelligence
Example: Prolog
Higher-Level Languages -
Fifth-Generation Languages
High level Programming Language
Advantages:
1) It is easy to use
2) Portability
3) Compact Instruction
Disadvantages:
1) Excessive use of memory
2) Program written are larger in size when
compiled
3) Slow speed of execution
Low level Programming Language
Advantages:
1) Fast execution of program
2) Provides for access to features of
computer
3) Smaller size when compiled.
Disadvantages:
1) Programs are made specifically for a
particular microprocessor.
2) Hard to debug
3) Program Syntax
4) Requires knowledge in microprocessors.
Summary
Intel 8086
Block Diagram of Intel 8086
The 8086 CPU is divided into two
independent functional units:
Bus Interface Unit (BIU)
Execution Unit (EU)
Bus Interface Unit (BIU)
The function of BIU is to:
Fetch the instruction or data from
memory.
Write the data to memory.
Write the data to the port.
Read data from the port.
Execution Unit (EU)
The functions of execution unit are:
To tell BIU where to fetch the
instructions or data from.
To decode the instructions.
To execute the instructions.
8086/8088 INTERNAL REGISTERS
General Purpose Registers
The general purpose registers are
used in any manner that the programmer
wishes. Each general purposes register is
addressable as 32-bit registers (EAX, EBX,
ECX, EDX), as 16-bit registers (AX, BX, CX,
DX) or as 8-bit registers using higher and
lower part of the 16-bit registers.
General Purpose Registers
Functions of General Purpose Registers:
1) AX (Accumulator)
is also known as accumulator
register that stores operands for
arithmetic operation like divided, rotate.
2) BX (Base)
This register is mainly used as
a base register. It holds the starting base
location of a memory region within a data
segment.
3) CX (Count)
It is defined as a counter. It is
primarily used in loop instruction to store
loop counter.
4) DX (Data)
It holds the most significant part
of the dividend before a division. DX
register is used to contain I/O port
address for I/O instruction.
Pointer and Index Register
although the pointer and
index-registers are also general purposes
in nature, they are more often used to
index or point to the memory location
holding the operand data for many
instructions.
1) SP (Stack Pointer)
used to address data in LIFO
(Last in First out) stack memory.
2) BP (Base Pointer)
used to point to the base of
the stack.
3) SI (Source Index)
used to address source data
indirectly for use with the string
instructions.
4) DI (Destination Index)
used to address destination
data indirectly for use with the string
instructions.
5) IP (Instruction Pointer)
Program Counter, is used to
store the memory location of the next
instruction to be executed.
Segment Registers
Additional registers called segment
registers generate memory address when
combined with other in the
microprocessor.
In 8086 microprocessor, memory is
divided into four(4) segments as follow:
1) CS (Code Segment)
The CS register is used for
addressing a memory location in the Code
Segment of the memory, where the
executable program is stored.
2) DS (Data Segment)
The DS contains most data
used by program. Data are accessed in the
Data Segment by an offset address or the
content of other register that holds the
offset address.
3) ES (Extra Segment)
ES is additional data segment that is
used by some of the string to hold the
destination data.
4) SS (Stack Segment)
SS defined the area of memory
used for the stack.
Quiz:
1. A vocabulary and set of grammatical rules for instructing a computer to perform
specific tasks
2. Which of the following is not an advantage of a low level language?
A. Fast execution of program
B. Provides for access to features of computer
C. It is portable.
D. Smaller size when compiled.
3. To create programs in assembly language, developers use ___________ to represent
strings of numbers.
4. Which of the following is not a disadvantage of low-level language?
A. Programs are made specifically for a particular microprocessor.
B. Slow speed of execution
C. Hard to debug
D. Program Syntax
5. Each general purposes register AX,BX, CX and DX is addressable as ____ -bit
registers.
6. The register that holds the temporary results after an arithmetic and logic operations.
7. The register that contains the count for shift and rotate instructions.
8. The register that is always used to address the next instruction executed by
the microprocessor.
9. It is a section of memory that holds programs and procedures used by
programs.
10. A section of memory that stores important machine state information,
subroutine return addresses, procedure parameters, and local variables.
11. A section of memory that generally points at global variables for the
program.
12. The register that also holds the most significant part of the dividend before
a division and the I/O part number for variable I/O instruction.
13. The generation of PL that is the first to use true English-like phrasing,
making them easier to use than previous languages(machine and assembly).
14. The generation of PL that uses a text-based environment or allows the
programmer to work in a visual environment, using graphical tools.
15. Assembly code is translated into object code, using a _________ .

Potrebbero piacerti anche