SlideShare a Scribd company logo
2
Most read
5
Most read
10
Most read
ASSEMBLY LANGUAGE
T S Pradeep Kumar
VIT University – Chennai Campus
http://www.pradeepkumar.org
Topics
• CPU Behavior
• Accumulator Based CPU
• Assembly language
• Pros and Cons of Assembly Language
• Elements of Assembly Language
• Example: AC = AC x N
• Greatest Common Divisor
• Macros and Subroutines
CPU Behavior
Lecture 4   assembly language
Accumulator based CPU
• All the arithmetic calculations happens at the Accumulator
  register
• Instructions are fetched by the program control Unit
  (PCU).
• They are executed in Data processing Unit (DPU)
• Instruction are typically look like this

• X1 =   fi (X1, X2)
• X1, X2 denotes a CPU register (AC, DR, or PC) or an
 external memory location M (address)
Accumulator based CPU
• fi is operation performed by the ALU are limited to Fixed
 point addition, subtraction, shifting and logical operations.
Assembly Language
• An assembly language is a symbolic representation of the
  machine language of a specific processor, augmented by
  additional types of statements that facilitate program
  writing and that provide instructions to the assembler
• An assembler is a program that translates assembly
  language into machine code.
• Assembly Language is hardware dependent with a
  different assembly language for each type of processor.
Advantages of Assembly Language over
HLL
• Debugging and Verification
• Making compilers
• Embedded systems
• Hardware drivers and system code
• Accessing instructions that are not accessible from HLL
• Self modifying code
• Optimizing code for size and speed
• Function libraries
Disadvantages of Assembly language
• Development time
• Reliability and security
• Debugging and verifying is difficult
• Maintainability
• Portability
• Compilers have been improved a lot in recent years
Assembly language elements
• Label
• Mnemonic
• Operands
• Comment
Example: AC = AC x N
Label   Mnemonic, operands   Comments
One     00…001               The constant one
Multi   N                    The multiplier
Ac      00...000             Location for initial value of Y in AC
Prod    00…000               Location for partial product P
        ST ac                Save initial value of Y of AC
Loop    LD mult              Load N into AC to test for termination
        BZ exit              Exit if N=0; otherwise continue
        LD one               Load 1 into AC
        MOV DR, AC           Move 1 from AC to DR
        LD mult              Load N into AC to decrement it
        SUB                  Subtract 1 from N
        ST mult              Store decremented N
        LD ac                Load initial value Y of AC
        MOV DR, AC           Move Y from AC to DR
Continued…
Label   Mnemonic, operands   comments
        LD prod              Load current partial product P
        ADD                  Add Y to P
        ST prod              Store the new partial product P
        BR loop              Branch to Loop
Exit    …..
Example - GCD
Example - GCD
Macros and Subroutines
• Macros and subroutines are useful for the simplification of
    program
•   Group of instructions to be treated as a single entities
•   Name        MACRO         Operand,…
                ………}
                ENDM
•   Macros are helpful in creating new opcode names
•   Introduce new data types and addressing modes
Macros
• Example of MACRO
• LDAI      MACRO        ADR
            LDHL         ADR
            MOV          A,M
            ENDM
Later,
LDAI 1000H
becomes a separate instruction
Subroutines
• Also called as procedure
• A subroutine definition is assembled into object code
• Two executable instructions
   • CALL or JUMP TO SUBROUTINE
   • RETURN
             CALL            SUB1
NEXT         …..
             …...
SUB1         ……
             ……
             RETURN
Subroutines
EVALUATION……
Ad

Recommended

Al2ed chapter7
Al2ed chapter7
Abdullelah Al-Fahad
 
Assembly language programming intro
Assembly language programming intro
United International University
 
Assembly Language Basics
Assembly Language Basics
Education Front
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
Advanced procedures in assembly language Full chapter ppt
Advanced procedures in assembly language Full chapter ppt
Muhammad Sikandar Mustafa
 
Lec 01 basic concepts
Lec 01 basic concepts
Abdul Khan
 
Lec 04 intro assembly
Lec 04 intro assembly
Abdul Khan
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Assembly language part I
Assembly language part I
Mohammed A. Imran
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
Introduction to Assembly Language Programming
Introduction to Assembly Language Programming
Rahul P
 
Microprocessor chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
Wondeson Emeye
 
8086 assembly language
8086 assembly language
Mir Majid
 
12109 microprocessor & programming
12109 microprocessor & programming
Gaurang Thakar
 
Intro to assembly language
Intro to assembly language
United International University
 
Assembly language programming
Assembly language programming
Gaurav Takrani
 
Assembly fundamentals
Assembly fundamentals
Syed Zaid Irshad
 
Assembly 8086
Assembly 8086
Mustafa Salah
 
Two pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
Alp 05
Alp 05
gswapnil86
 
Introduction to Assembly Language
Introduction to Assembly Language
ApekshaShinde6
 
Unit 1 cd
Unit 1 cd
codereplugd
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
Khaja Dileef
 
Assembly language programming
Assembly language programming
himhk
 
8086 assembly
8086 assembly
Shehrevar Davierwala
 
Coal 21- macro in Assembly Programming
Coal 21- macro in Assembly Programming
Muhammad Taqi Hassan Bukhari
 
Presentation1
Presentation1
Aastha Kalra
 
Macro
Macro
jayashri kolekar
 

More Related Content

What's hot (19)

Assembly language part I
Assembly language part I
Mohammed A. Imran
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
Introduction to Assembly Language Programming
Introduction to Assembly Language Programming
Rahul P
 
Microprocessor chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
Wondeson Emeye
 
8086 assembly language
8086 assembly language
Mir Majid
 
12109 microprocessor & programming
12109 microprocessor & programming
Gaurang Thakar
 
Intro to assembly language
Intro to assembly language
United International University
 
Assembly language programming
Assembly language programming
Gaurav Takrani
 
Assembly fundamentals
Assembly fundamentals
Syed Zaid Irshad
 
Assembly 8086
Assembly 8086
Mustafa Salah
 
Two pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
Alp 05
Alp 05
gswapnil86
 
Introduction to Assembly Language
Introduction to Assembly Language
ApekshaShinde6
 
Unit 1 cd
Unit 1 cd
codereplugd
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
Khaja Dileef
 
Assembly language programming
Assembly language programming
himhk
 
8086 assembly
8086 assembly
Shehrevar Davierwala
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
Introduction to Assembly Language Programming
Introduction to Assembly Language Programming
Rahul P
 
Microprocessor chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
Wondeson Emeye
 
8086 assembly language
8086 assembly language
Mir Majid
 
12109 microprocessor & programming
12109 microprocessor & programming
Gaurang Thakar
 
Assembly language programming
Assembly language programming
Gaurav Takrani
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
Introduction to Assembly Language
Introduction to Assembly Language
ApekshaShinde6
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
Khaja Dileef
 
Assembly language programming
Assembly language programming
himhk
 

Viewers also liked (20)

Coal 21- macro in Assembly Programming
Coal 21- macro in Assembly Programming
Muhammad Taqi Hassan Bukhari
 
Presentation1
Presentation1
Aastha Kalra
 
Macro
Macro
jayashri kolekar
 
Pre processor directives in c
Pre processor directives in c
baabtra.com - No. 1 supplier of quality freshers
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
Parth Mudgal
 
Memory allocation
Memory allocation
sanya6900
 
SAS Macros
SAS Macros
guest2160992
 
System programming
System programming
jayashri kolekar
 
Ss4
Ss4
Jaya Chavan
 
Memory allocation (4)
Memory allocation (4)
rockymani
 
Wireless cellular technologies draft0.3
Wireless cellular technologies draft0.3
ganeshmaali
 
Wireless cellular technologies
Wireless cellular technologies
ganeshmaali
 
Introduction to Wireless cellular technologie and NGN,IMS
Introduction to Wireless cellular technologie and NGN,IMS
ganeshmaali
 
Assembly Language Lecture 2
Assembly Language Lecture 2
Motaz Saad
 
Introduction to systems programming
Introduction to systems programming
Mukesh Tekwani
 
Cellular network,1st generation,2nd generation
Cellular network,1st generation,2nd generation
Inimitable Harish
 
5432 cellular network
5432 cellular network
Raafat younis
 
System Programing Unit 1
System Programing Unit 1
Manoj Patil
 
System Programming Unit II
System Programming Unit II
Manoj Patil
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Similar to Lecture 4 assembly language (20)

03-IntroAssembly.pptx Introduction to assmebly language
03-IntroAssembly.pptx Introduction to assmebly language
DanielSolomon72
 
Code generator
Code generator
Tech_MX
 
Onnc intro
Onnc intro
Luba Tang
 
Introduction to Processor Design in System Verilog
Introduction to Processor Design in System Verilog
aasgharbee22seecs
 
The Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACC
inside-BigData.com
 
Rig nitc [autosaved] (copy)
Rig nitc [autosaved] (copy)
Aravind E Vijayan
 
Haskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHC
dterei
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
Manikandan813397
 
8051 microcontroller
8051 microcontroller
Shubhrika Sehgal
 
02 direct3 d_pipeline
02 direct3 d_pipeline
Girish Ghate
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
Linaro
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
Expo de digitales (2)
Expo de digitales (2)
Carlos Eduardo Torres
 
C programming session9 -
C programming session9 -
Keroles karam khalil
 
Java SE 8 library design
Java SE 8 library design
Stephen Colebourne
 
Introduction to Blackfin BF532 DSP
Introduction to Blackfin BF532 DSP
Pantech ProLabs India Pvt Ltd
 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptx
Drkoteswararaoseelam
 
Lecture 16 17 code-generation
Lecture 16 17 code-generation
Iffat Anjum
 
Follow the (Kafka) Streams
Follow the (Kafka) Streams
confluent
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
03-IntroAssembly.pptx Introduction to assmebly language
03-IntroAssembly.pptx Introduction to assmebly language
DanielSolomon72
 
Code generator
Code generator
Tech_MX
 
Introduction to Processor Design in System Verilog
Introduction to Processor Design in System Verilog
aasgharbee22seecs
 
The Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACC
inside-BigData.com
 
Haskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHC
dterei
 
02 direct3 d_pipeline
02 direct3 d_pipeline
Girish Ghate
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
Linaro
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptx
Drkoteswararaoseelam
 
Lecture 16 17 code-generation
Lecture 16 17 code-generation
Iffat Anjum
 
Follow the (Kafka) Streams
Follow the (Kafka) Streams
confluent
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
Ad

More from Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and Footprint
Pradeep Kumar TS
 
Open book Examination
Open book Examination
Pradeep Kumar TS
 
Software Define Networking (SDN)
Software Define Networking (SDN)
Pradeep Kumar TS
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
Pradeep Kumar TS
 
Protothreads
Protothreads
Pradeep Kumar TS
 
6LoWPAN
6LoWPAN
Pradeep Kumar TS
 
Software Defined Networks
Software Defined Networks
Pradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
Pradeep Kumar TS
 
IoT Communication Protocols
IoT Communication Protocols
Pradeep Kumar TS
 
IoT Applications
IoT Applications
Pradeep Kumar TS
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
Pradeep Kumar TS
 
Mannasim for NS2
Mannasim for NS2
Pradeep Kumar TS
 
Recompiling network simulator 2
Recompiling network simulator 2
Pradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
Pradeep Kumar TS
 
Installation of ns2
Installation of ns2
Pradeep Kumar TS
 
Introduction to ns2
Introduction to ns2
Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1
Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2
Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3
Pradeep Kumar TS
 
Digital Portfolio and Footprint
Digital Portfolio and Footprint
Pradeep Kumar TS
 
Software Define Networking (SDN)
Software Define Networking (SDN)
Pradeep Kumar TS
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
Pradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
Pradeep Kumar TS
 
IoT Communication Protocols
IoT Communication Protocols
Pradeep Kumar TS
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
Pradeep Kumar TS
 
Recompiling network simulator 2
Recompiling network simulator 2
Pradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1
Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2
Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3
Pradeep Kumar TS
 

Recently uploaded (20)

Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 

Lecture 4 assembly language

  • 1. ASSEMBLY LANGUAGE T S Pradeep Kumar VIT University – Chennai Campus http://www.pradeepkumar.org
  • 2. Topics • CPU Behavior • Accumulator Based CPU • Assembly language • Pros and Cons of Assembly Language • Elements of Assembly Language • Example: AC = AC x N • Greatest Common Divisor • Macros and Subroutines
  • 5. Accumulator based CPU • All the arithmetic calculations happens at the Accumulator register • Instructions are fetched by the program control Unit (PCU). • They are executed in Data processing Unit (DPU) • Instruction are typically look like this • X1 = fi (X1, X2) • X1, X2 denotes a CPU register (AC, DR, or PC) or an external memory location M (address)
  • 6. Accumulator based CPU • fi is operation performed by the ALU are limited to Fixed point addition, subtraction, shifting and logical operations.
  • 7. Assembly Language • An assembly language is a symbolic representation of the machine language of a specific processor, augmented by additional types of statements that facilitate program writing and that provide instructions to the assembler • An assembler is a program that translates assembly language into machine code. • Assembly Language is hardware dependent with a different assembly language for each type of processor.
  • 8. Advantages of Assembly Language over HLL • Debugging and Verification • Making compilers • Embedded systems • Hardware drivers and system code • Accessing instructions that are not accessible from HLL • Self modifying code • Optimizing code for size and speed • Function libraries
  • 9. Disadvantages of Assembly language • Development time • Reliability and security • Debugging and verifying is difficult • Maintainability • Portability • Compilers have been improved a lot in recent years
  • 10. Assembly language elements • Label • Mnemonic • Operands • Comment
  • 11. Example: AC = AC x N Label Mnemonic, operands Comments One 00…001 The constant one Multi N The multiplier Ac 00...000 Location for initial value of Y in AC Prod 00…000 Location for partial product P ST ac Save initial value of Y of AC Loop LD mult Load N into AC to test for termination BZ exit Exit if N=0; otherwise continue LD one Load 1 into AC MOV DR, AC Move 1 from AC to DR LD mult Load N into AC to decrement it SUB Subtract 1 from N ST mult Store decremented N LD ac Load initial value Y of AC MOV DR, AC Move Y from AC to DR
  • 12. Continued… Label Mnemonic, operands comments LD prod Load current partial product P ADD Add Y to P ST prod Store the new partial product P BR loop Branch to Loop Exit …..
  • 15. Macros and Subroutines • Macros and subroutines are useful for the simplification of program • Group of instructions to be treated as a single entities • Name MACRO Operand,… ………} ENDM • Macros are helpful in creating new opcode names • Introduce new data types and addressing modes
  • 16. Macros • Example of MACRO • LDAI MACRO ADR LDHL ADR MOV A,M ENDM Later, LDAI 1000H becomes a separate instruction
  • 17. Subroutines • Also called as procedure • A subroutine definition is assembled into object code • Two executable instructions • CALL or JUMP TO SUBROUTINE • RETURN CALL SUB1 NEXT ….. …... SUB1 …… …… RETURN