Mansoura University
Faculty of Computers and Information
Department of Computer Science
First Semester: 2021-2022
[CS214P] Assembly Language: An Introduction
Grade: Third Year (Computer Science)
Sara El-Metwally, Ph.D.
Faculty of Computers and Information,
Mansoura University,
Egypt.
Course outlines
o Course Meeting Time:
Saturday, 12.10 pm – 1:50 pm
o Grading :
Activities Percentages
Attendance (Lectures + Sections ) 5%
Practical exam 15%
Midterm 10%
Oral 10%
Final 60%
Course outlines
o Course Text Book:
Course outlines
o Course Labs “ materials ”:
Assignments and solving some exercises.
DosBox.
Debug Program.
Emulator 8086.
AE-TASM.
o Course TA’s:
Eng. Ghada Shafiq, Eng. Esraa Salah, Eng. Ola
Magdy.
Course Objectives
o Understand the HW of the personal computer.
o Understand machine-language code and hexa-
decimal format.
o Understand the steps involved in assembling,
linking, and executing a program.
o Write programs in assembly language to handle the
keyboard and screen, perform arithmetic, convert
between ASCII and binary formats, perform table
searches and sorts, and handle disk I/O.
Course Objectives
o Trace machine execution as an aid in program
debugging.
o Write your own macro instructions to facilitate
faster coding.
o Linking separately assembled programs into one
executable program.
Course Requirements
Logic Design
First Academic Year
Computers Architecture
and Organization Second Academic Year
Assembly Language
Third Academic Year
Compilers
Fourth Academic Year
Microprocessors
Embedded Systems
Why Assembly? (Knowledge)
o Shows how program interface with operating
system, processor and BIOS.
o Show how data is represented and stored in
memory and on external devices.
o Show how processors access and execute
instructions and how instructions access and
process data.
o Show how a program access external devices.
Why Assembly in 2021?
o Programs written in assembly requires less
memory and execution time.
o Give programmers the flexibility to perform
low level machine operations and highly
technical tasks.
o While most software written in high-level
programming languages, a common practice is
to recode in assembly those sections that are
time-critical.
Why Assembly in 2021?
Why Assembly in 2021?
Levels of Programming
o Machine language: instructions in a sequence
of ones and zeros that the processor executes
one at a time.
o Low-level assembly language: instructions in a
symbolic format designed for a specific
processor and have one to one machine code.
o High-level language: designed to eliminate the
technicality of low level hardware details and
generate many low-level instructions.
Levels of Programming
High-level language
Compiler
Low-level assembly language
Assembler
Machine language
What is Assembly Language?
o Assembly language is a low-level programming
language for a computer or other programmable
device specific to a particular computer
architecture.
o Each personal computer has a microprocessor that
manages the computer's arithmetical, logical, and
control activities.
o Each family of processors has its own set of
instructions for handling various operations such
as getting input from keyboard, displaying
information on screen etc.
To Start:
You need to know your Computer ?
0101 0000 0000 500H
Address Word
502H Instruction
LOAD 361
361H Data
2
Memory
To Start:
You need to know your Computer ?
To Start:
You need to know your Computer ?
Word Size in bits
Memory Memory size in words
( 1MB)
To Start:
You need to know your Computer ?
01010110 0001 0001 0010 0010 1111 0x1122F
Memory
( 1MB)
To Start:
You need to know your Computer ?
CPU
Fetch
011100011
Decode
Instruction
011100011
ADD 5,2
Execute
00000111 Memory
7
To Start:
You need to know your Computer ?
ALU
CU Address Bus
Data Bus
Registers
Control Bus
Intel 8086 (x86 architecture)
o 16-bit registers.
o 16-bit data bus.
o 1 MB internal memory.
o Word size = 1 byte.
How many bits for address bus?
20 bits
How many words can be fetched from a
memory at a time?
2 words
Intel 8086 (x86 architecture)
Intel 8086 (x86 architecture)
64K base system ROM
192K memory expansion area ROM
BIOS data area
Interrupt Vector Table
Addressing Data in Memory
the Intel x86 processors use little-endian.
We need to store
0529H in memory 04A27 05
04A26 29
How many words we need? --------
2 words 00001
00000
05 29
Register Memory
(Queue) (Stack)
Addressing Data in Memory
o An absolute address: 20-bit value that directly
references a specific location in memory.
o A segment : offset address, combines the
starting address of a segment with an offset
value.
Addressing Data in Memory
An absolute address
04A27
04A26
--------
00001
00000
Memory
(Stack)
Addressing Data in Memory
04F03 = 04F00 + 0003
04F03
04F02
04F01
Segment offset
04F00 04F00
Segment
Segment start address (array)
04C00
04A00
Thank You!