Computer System Low- Level Techniques
CT073-3-2
Introduction to Assembly Language
Topic & Structure of The Lesson
• Generation Of Languages
• Compilation Stages
• Reasons For Assembly Language
• Instruction Syntax/Format
• Memory Model
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹2› of 23
Learning Outcomes
• At the end of this topic, You should be able
to
– Understand the requirements of the memory
models for assembly language programs.
– Understand how to produce an executable
program based on assembly language.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹3› of 23
Key Terms You Must Be Able To
Use
• If you have mastered this topic, you should be able to use the following
terms correctly in your assignments and exams:
– Assembly Language.
– Compiler.
– Memory model.
– Registers.
– Segment/Offset.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹4› of 23
Generation Of Languages
1. Machine Language
2. Assembly Language (symbolic language)
3. Procedure Oriented Languages
4. Problem Oriented Languages
5. Artificial Intelligence
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹5› of 23
Compilation Stages
. Step 1. Source
Program Creation
With the Text Editor Code
Step 4.
Program
Execution
Step 2.
Program
Compilation
With The
Assembly Compiler
Step 3.
Program Linking Intermediate
With The Object
Assembly Linker Code
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹6› of 23
Reasons For Assembly Language
• Develop programs which are very small in
its size (small object codes)
• Develop programs which perform very
quickly (fast execution speed)
• Develop powerful programs (as they
enable direct links with hardware devices)
• Allow us to understand the operations of
the computer, since the program is
operating at the lowest level.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹7› of 23
Reasons For Not Assembly Language
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹8› of 23
Instruction Syntax/Format
An assembly language statement can be divided
into four general section, as shown below:-
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹9› of 23
Name/Label
This part of the assembly language
statement/instruction allows you to specify a user-
defined identifier which is used to uniquely identify
an object (or element) within the program.
Objects or elements within the program can include
variables or even procedures.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹10› of 23
Operation and Operand
Operation
This item, within an assembly language instruction, refers
to the task to be carried out.
Types of operations would include such tasks as moving
data between different areas of the computer system
Operand
Most instructions are incomplete if operands are not
specified.
Operands refers to data sources which the instruction is
obtaining its data from, and may include data from the
computer system's memory or the computer system's
internal registers.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹11› of 23
Comments
Being a language which operates closest to the
lowest language level of a machine, comments
should be easily included in the program to
improve readability.
The last item of the assembly language instruction
syntax refers to the comments.
Comments within an assembly language program
begins with a semi-colon.
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹12› of 23
Example Program
http://www.ctyme.com/intr/int-21.htm
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹13› of 23
Example Program
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹14› of 23
Memory Model
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹15› of 23
Example Program
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹16› of 23
Stack Segment
.STACK size
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹17› of 23
Example Program
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹18› of 23
Example Program
.model small
.stack 100h
.code
MAIN PROC
;****** display a prompt
mov ah,2 ; display a character function
mov dl,'?' ; character ? is displayed
int 21h ; call DOS to display
; ****** end program
mov ah,4Ch ; DOS exit function
int 21h ; exit to DOS
MAIN endp
end MAIN
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹19› of 23
Example Program
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹20› of 23
Summary of Main Teaching Points
• The process of producing an executable
program through assembly language
requires 4 stages/steps.
• Five memory models are SMALL,
MEDIUM, COMPACT, LARGE and HUGE
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹21› of 23
Question and Answer Session
Q&A
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹22› of 23
What we will cover next
Services
CT073-2-3 and CSLLT Introduction to assembly Language Slide ‹23› of 23