CENG241 Chapter 1
CENG241 Chapter 1
Chapter 1
S. Dandamudi
Outline
• A user’s view of computer • Why program in assembly
systems language?
• What is assembly language? – Time-efficiency
– Relationship to machine – Space-efficiency
language – Accessibility to hardware
• Advantages of high-level • Typical applications
languages • Why learn assembly
– Faster program development language?
– Easier maintenance
– Portability
2005
To be used with S. Dandamudi,
“Introduction to Assembly
Language Programming,”
Second Edition, Springer, S. Dandamudi Chapter 1: Page 2
2005.
A User’s View of Computer Systems
(cont’d)
2005
To be used with S. Dandamudi,
“Introduction to Assembly
Language Programming,”
Second Edition, Springer, S. Dandamudi Chapter 1: Page 3
2005.
A User’s View of Computer Systems
• Depends on the degree of abstraction provided
by the underlying software
• We consider a hierarchy of five levels
– Moving to the top of hierarchy shields the user from
the lower-level details
– The top two levels are system independent
– The lower four levels are system dependent
• Assembly and machine languages are specific to a particular
processor
• One-to-one correspondence between assembly language
2005 and machine language
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 4
Language Programming,”
What Is Assembly Language?
• Low-level language
• Each instruction performs a much lower-level task compared to a
high-level language instruction
• One-to-one correspondence between assembly
language and machine language instructions
• For most assembly language instructions, there is a machine
language equivalent
• Assembler translates assembly language instructions to machine
language instructions
• Directly influenced by the instruction set and
2005 architecture of the processor (CPU)
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 5
Language Programming,”
What Is Assembly Language?
(Cont’d)
• Some example assembly language instructions:
inc result MIPS Examples
andi $t2,$t1,15
mov class_size,45
addu $t3,$t1,$t2
and mask1,128
move $t2,$t1
add marks,10
• Some points to note:
• Assembly language instructions are cryptic
• Mnemonics are used for operations
– inc for increment, mov for move (i.e., copy)
• Assembly language instructions are low level
– Cannot write instructions such as
mov marks, value
2005
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 6
Language Programming,”
What Is Assembly Language?
(Cont’d)
• Some simple high-level language instructions
can be expressed by a single assembly
instruction
Assembly Language C
inc result result++;
mov class_size,45 class_size = 45;
and mask1,128 mask1 &= 128;
add marks,10 marks += 10;
2005
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 7
Language Programming,”
What Is Assembly Language?
(Cont’d)
• Most high-level language instructions need more
than one assembly instruction
C Assembly Language