0% found this document useful (0 votes)
12 views15 pages

CENG241 Chapter 1

The document provides an introduction to assembly language programming, discussing its relationship to machine language, advantages over high-level languages, and typical applications. It emphasizes the importance of efficiency, accessibility to hardware, and the need for learning assembly language for certain applications. The document also outlines the structure of computer systems and the role of assembly language in understanding computer organization.

Uploaded by

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

CENG241 Chapter 1

The document provides an introduction to assembly language programming, discussing its relationship to machine language, advantages over high-level languages, and typical applications. It emphasizes the importance of efficiency, accessibility to hardware, and the need for learning assembly language for certain applications. The document also outlines the structure of computer systems and the role of assembly language in understanding computer organization.

Uploaded by

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

Introduction

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

size = value; mov AX,value


mov size,AX

sum += x + y + z; mov AX,sum


add AX,x
add AX,y
add AX,z
2005
mov sum,AX
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 8
Language Programming,”
What Is Assembly Language?
(Cont’d)
• Readability of assembly language instructions is
much better than the machine language
instructions
• Machine language instructions are a sequence of 1s and 0s

Assembly Language Machine Language


(in Hex)
inc result FF060A00
mov class_size,45 C7060C002D00
and mask,128 80260E0080
2005
add
To be used with S. Dandamudi,
marks,10 83060F000A
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 9
Language Programming,”
What Is Assembly Language?
(Cont’d)
• MIPS examples

Assembly Language Machine Language


(in Hex)
nop 00000000
move $t2,$t15 000A2021
andi $t2,$t1,15 312A000F
addu $t3,$t1,$t2 012A5821
2005
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 10
Language Programming,”
Advantages of High-level
Languages
• Program development is faster
• High-level instructions
– Fewer instructions to code

• Programs maintenance is easier


• For the same reasons as above
• Programs are portable
• Contain few machine-dependent details
– Can be used with little or no modifications on different types of
machines
• Compiler translates to the target machine language
• Assembly language programs are not portable
2005
S. Dandamudi Chapter 1: Page 11
To be used with S. Dandamudi,
Why Program in Assembly
Language?
• Two main reasons:
– Efficiency
• Space-efficiency
• Time-efficiency
– Accessibility to system hardware
• Space-efficiency
– Assembly code tends to be compact
• Time-efficiency
– Assembly language programs tend to run faster
• Only a well-written assembly language program runs faster
– Easy to write an assembly program that runs slower than its high-
2005
level language equivalent
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 12
Language Programming,”
Typical Applications
• Application that need one of the three advantages of the
assembly language
1. Time-efficiency
– Time-convenience
• Good to have but not required for functional correctness
– Graphics
– Time-critical
• Necessary to satisfy functionality
• Real-time applications
– Aircraft navigational systems
– Process control systems
– Robot control software
2005 – Missile control software
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 13
Language Programming,”
Typical Applications (cont’d)
2. Accessibility to system hardware
– System software typically requires direct control of the
system hardware devices
• Assemblers, linkers, compilers
• Network interfaces, device drivers
• Video games
3. Space-efficiency
– Not a big plus point for most applications
– Code compactness is important in some cases
– Portable and hand-held device software
– Spacecraft control software
. S. Dandamudi Chapter 1: Page 14
Why Learn Assembly Language?
• Some applications require programming in assembly
language
• Typically only a small part of an application is coded in assembly
language (rest written in a high-level language)
– Such programs are called mixed mode programs

• Assembly language can be used as a tool to learn


computer organization
• You will know more about the organization and internal workings
of a computer system
• Personal satisfaction of learning something
2005 complicated and useful
To be used with S. Dandamudi,
“Introduction to Assembly
S. Dandamudi Chapter 1: Page 15
Language Programming,”

You might also like