SlideShare uma empresa Scribd logo
1 de 19
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
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……

Mais conteúdo relacionado

Mais procurados

Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...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 ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingRahul P
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
12109 microprocessor & programming
12109 microprocessor & programming12109 microprocessor & programming
12109 microprocessor & programmingGaurang Thakar
 
Assembly language programming
Assembly language programming Assembly language programming
Assembly language programming Gaurav Takrani
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programmingMakerere university
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language ApekshaShinde6
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-IIIDr.YNM
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Khaja Dileef
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programminghimhk
 

Mais procurados (19)

Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
12109 microprocessor & programming
12109 microprocessor & programming12109 microprocessor & programming
12109 microprocessor & programming
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
Assembly language programming
Assembly language programming Assembly language programming
Assembly language programming
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
Alp 05
Alp 05Alp 05
Alp 05
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
 
Unit 1 cd
Unit 1 cdUnit 1 cd
Unit 1 cd
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-III
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programming
 
8086 assembly
8086 assembly8086 assembly
8086 assembly
 

Destaque

Destaque (20)

Coal 21- macro in Assembly Programming
Coal 21- macro in Assembly ProgrammingCoal 21- macro in Assembly Programming
Coal 21- macro in Assembly Programming
 
Presentation1
Presentation1Presentation1
Presentation1
 
Macro
MacroMacro
Macro
 
Pre processor directives in c
Pre processor directives in cPre processor directives in c
Pre processor directives in c
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
 
Memory allocation
Memory allocationMemory allocation
Memory allocation
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
 
System programming
System programmingSystem programming
System programming
 
Ss4
Ss4Ss4
Ss4
 
Memory allocation (4)
Memory allocation (4)Memory allocation (4)
Memory allocation (4)
 
Wireless cellular technologies draft0.3
Wireless cellular technologies draft0.3Wireless cellular technologies draft0.3
Wireless cellular technologies draft0.3
 
Wireless cellular technologies
Wireless cellular technologiesWireless cellular technologies
Wireless cellular technologies
 
Introduction to Wireless cellular technologie and NGN,IMS
Introduction to Wireless cellular technologie  and NGN,IMS Introduction to Wireless cellular technologie  and NGN,IMS
Introduction to Wireless cellular technologie and NGN,IMS
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Cellular network,1st generation,2nd generation
Cellular network,1st generation,2nd generationCellular network,1st generation,2nd generation
Cellular network,1st generation,2nd generation
 
5432 cellular network
5432 cellular network5432 cellular network
5432 cellular network
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit II
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 

Semelhante a Lecture 4 assembly language

Code generator
Code generatorCode generator
Code generatorTech_MX
 
The Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACCThe Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACCinside-BigData.com
 
Haskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHCHaskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHCdterei
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipelineGirish Ghate
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 Linaro
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxassembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxDrkoteswararaoseelam
 
Lecture 16 17 code-generation
Lecture 16 17 code-generationLecture 16 17 code-generation
Lecture 16 17 code-generationIffat Anjum
 
Follow the (Kafka) Streams
Follow the (Kafka) StreamsFollow the (Kafka) Streams
Follow the (Kafka) Streamsconfluent
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsishitasabrincse
 
isa architecture
isa architectureisa architecture
isa architectureAJAL A J
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdlArshit Rai
 

Semelhante a Lecture 4 assembly language (20)

Code generator
Code generatorCode generator
Code generator
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
The Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACCThe Past, Present, and Future of OpenACC
The Past, Present, and Future of OpenACC
 
Rig nitc [autosaved] (copy)
Rig nitc [autosaved] (copy)Rig nitc [autosaved] (copy)
Rig nitc [autosaved] (copy)
 
Haskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHCHaskell Symposium 2010: An LLVM backend for GHC
Haskell Symposium 2010: An LLVM backend for GHC
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptxEC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipeline
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Expo de digitales (2)
Expo de digitales (2)Expo de digitales (2)
Expo de digitales (2)
 
C programming session9 -
C programming  session9 -C programming  session9 -
C programming session9 -
 
Java SE 8 library design
Java SE 8 library designJava SE 8 library design
Java SE 8 library design
 
Introduction to Blackfin BF532 DSP
Introduction to Blackfin BF532 DSPIntroduction to Blackfin BF532 DSP
Introduction to Blackfin BF532 DSP
 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxassembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptx
 
Lecture 16 17 code-generation
Lecture 16 17 code-generationLecture 16 17 code-generation
Lecture 16 17 code-generation
 
Follow the (Kafka) Streams
Follow the (Kafka) StreamsFollow the (Kafka) Streams
Follow the (Kafka) Streams
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
 
isa architecture
isa architectureisa architecture
isa architecture
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 

Mais de Pradeep Kumar TS

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and FootprintPradeep Kumar TS
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)Pradeep Kumar TS
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesPradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingPradeep Kumar TS
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication ProtocolsPradeep Kumar TS
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksPradeep Kumar TS
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2Pradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3Pradeep Kumar TS
 

Mais de Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 

Último

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Último (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

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
  • 4.
  • 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