SlideShare une entreprise Scribd logo
1  sur  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……

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Dernier (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

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