SlideShare a Scribd company logo
Microprocessor & its Applications
Module 3 Continued……
Dr. Girisha G S
Dept. of CSE
SoE, DSU, Bengaluru
1
Agenda
• LOOP instruction
• Controlling the Flow of Program
• Data declaration directives
Syntax: LOOP Label
- The instruction LOOP is used to execute a group of instruction repeatedly a specified
number of times.
- The CX register must be loaded with loop count (the number of times the LOOP is to be
repeated).
- When LOOP is executed,
i) register CX is decremented by one automatically.
ii) If CX != 0 it jumps to the address indicated by label.
If CX becomes zero, execution will continue to the instruction following the LOOP.
- The LOOP instruction is a combination of a decrement CX and the JNZ conditional jump.
LOOP: Loop if CX not zero
Example : calculate sum of 8bit numbers from 1-10
MOV AL,0 ; sum = AL
MOB BL,1 ; first number=BL
MOV CX, 0AH ; count=CX
L1: ADD AL,BL ; accumulate sum in AX
INC BL ; next number=BL
LOOP L1 ; decrement CX until 0
DEC CX
JNZ L1
Controlling The Flow of an Assembly Language Program
.IF-.ELSE-.ENDIF statement
- Useful for making decision.
General format of the .IF conditional statement:
.IF (condition)
……
.ELSE (optional)
……
.ENDIF (end of if)
- The assembly language also allows to use relational operator with .IF statement.
- The table list the relational operators.
Operator Function
== equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
& Bit test
| OR
! logical inverter
&& logical AND
|| logical OR
TITLE ”8086 ALP TO CONVERT LOWERCASE TO UPPER CASE”
.MODEL SMALL
.CODE
MOV AX,@DATA
MOV DS, AX
MOV AH, 01H ; read character from keyboard in AL
INT 21H
.IF AL >=’a’ && AL <=’z’ ; if character is lower case , subtract 20H
SUB AL, 20H
.ENDIF
MOV DL,AL ; display character on screen whose ascii code is stored in DL
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
END
Example:
- letters A through Z are
represented as 41H through 5AH
- letters a through z are
represented as 61H through 7AH
.WHILE-.ENDW statement
Format of the while statement:
.WHILE (CONDITION)
-----------
-----------
.ENDW
Example program: list all alphabets
.MODEL
.CODE
MOV AX,@DATA
MOV DS, AX
MOV DL,’A’
.WHILE DL <= ’Z’
MOV AH,02H
INT 21H
INC DL
.ENDW
MOV AH,4CH
INT 21H
END
- Test the loop condition before executing the loop body. The .ENDW directive marks the
end of the loop
.REPEAT-.UNTIL STATEMENT
Format of the .repeat-.until while statement:
.REPEAT
-----------
-----------
.UNTIL (Condition)
Example program : list all alphabets
.MODEL
.CODE
MOV AX,@DATA
MOV DS, AX
MOV DL,’A’
.REPEAT
MOV AH,02H
INT 21H
INC DL
.UNTIL DL<=’Z’
MOV AH,4CH
INT 21H
END
- Executes the loop body before testing the loop condition associated with .UNTIL
directive
Data Declaration Directives
• DB
The DB directive is used to declare a BYTE variable – A BYTE is made up of 8 bits.
Examples:
N1 DB 10h ; delcare and initialize 1 byte variable named N1
N2 DB ? ; declare 1 byte variable named N2 with no initial value
LITST DB 21H,22H,23H,24H : declare an array LIST with 5 bytes and initializes with value
LIST2 DB 10 DUP(?) ; declare an array of 10 bytes with no initial value
S1 DB “Hello$” ; declare an array of 5 bytes and initialize with ASCII code of letters “Hello”
• DW
– The DW directive is used to declare a WORD type variable – A WORD occupies 16
bits or (2 BYTE).
Examples:
N2 DW 1234h
Syntax:
variable_name type initial_value [,initial_value]……
Syntax:
variable_name type initial_value [,initial_value]……
Loop instruction, controlling the flow of progam
Ad

More Related Content

What's hot (20)

Demultiplexing of buses of 8085 microprocessor
Demultiplexing of buses of 8085 microprocessor Demultiplexing of buses of 8085 microprocessor
Demultiplexing of buses of 8085 microprocessor
Rajal Patel
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
Aswini Dharmaraj
 
Register of 80386
Register of 80386Register of 80386
Register of 80386
aviban
 
Loaders
LoadersLoaders
Loaders
Mohd Arif
 
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
ATUL KUMAR YADAV
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
Zubair Khalid
 
Computer instruction
Computer instructionComputer instruction
Computer instruction
Sanjeev Patel
 
PAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 MicroporcessorPAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 Microporcessor
KanchanPatil34
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
Nahian Ahmed
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
anil_gaur
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
milandhara
 
Linkers
LinkersLinkers
Linkers
Tech_MX
 
8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
RAMESHBABUA3
 
Time delay programs and assembler directives 8086
Time delay programs and assembler directives 8086Time delay programs and assembler directives 8086
Time delay programs and assembler directives 8086
Dheeraj Suri
 
8086 memory interface.pptx
8086 memory interface.pptx8086 memory interface.pptx
8086 memory interface.pptx
HebaEng
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
Bharat Kalia
 
Common Bus System.pptx
Common Bus System.pptxCommon Bus System.pptx
Common Bus System.pptx
NancyBeaulah_R
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
deval patel
 
Demultiplexing of buses of 8085 microprocessor
Demultiplexing of buses of 8085 microprocessor Demultiplexing of buses of 8085 microprocessor
Demultiplexing of buses of 8085 microprocessor
Rajal Patel
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
Aswini Dharmaraj
 
Register of 80386
Register of 80386Register of 80386
Register of 80386
aviban
 
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
ATUL KUMAR YADAV
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
Zubair Khalid
 
Computer instruction
Computer instructionComputer instruction
Computer instruction
Sanjeev Patel
 
PAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 MicroporcessorPAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 Microporcessor
KanchanPatil34
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
Nahian Ahmed
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
anil_gaur
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
milandhara
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
Time delay programs and assembler directives 8086
Time delay programs and assembler directives 8086Time delay programs and assembler directives 8086
Time delay programs and assembler directives 8086
Dheeraj Suri
 
8086 memory interface.pptx
8086 memory interface.pptx8086 memory interface.pptx
8086 memory interface.pptx
HebaEng
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
Bharat Kalia
 
Common Bus System.pptx
Common Bus System.pptxCommon Bus System.pptx
Common Bus System.pptx
NancyBeaulah_R
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
deval patel
 

Similar to Loop instruction, controlling the flow of progam (20)

Assembly language programs
Assembly language programsAssembly language programs
Assembly language programs
HarshitParkar6677
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
warda aziz
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
HarshitParkar6677
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
NishatNishu5
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
techbed
 
Al2ed chapter7
Al2ed chapter7Al2ed chapter7
Al2ed chapter7
Abdullelah Al-Fahad
 
Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSE
salmancreation
 
lecture4 control flow instruction in assembly.pptx
lecture4 control flow instruction in assembly.pptxlecture4 control flow instruction in assembly.pptx
lecture4 control flow instruction in assembly.pptx
malnaham
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
LECTURE_5 Program Control Instructions.pptx
LECTURE_5 Program Control Instructions.pptxLECTURE_5 Program Control Instructions.pptx
LECTURE_5 Program Control Instructions.pptx
BifaHirpo1
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
guest2bb25
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
guest2bb25
 
X86 operation types
X86 operation typesX86 operation types
X86 operation types
Rowena Cornejo
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
Ravi Anand
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Vijay Kumar
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
AmitPaliwal20
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
inian2
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.ppt
ssuser2b759d
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
warda aziz
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
warda aziz
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
HarshitParkar6677
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
NishatNishu5
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
techbed
 
Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSE
salmancreation
 
lecture4 control flow instruction in assembly.pptx
lecture4 control flow instruction in assembly.pptxlecture4 control flow instruction in assembly.pptx
lecture4 control flow instruction in assembly.pptx
malnaham
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
LECTURE_5 Program Control Instructions.pptx
LECTURE_5 Program Control Instructions.pptxLECTURE_5 Program Control Instructions.pptx
LECTURE_5 Program Control Instructions.pptx
BifaHirpo1
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
Ravi Anand
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Vijay Kumar
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
AmitPaliwal20
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
inian2
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.ppt
ssuser2b759d
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
warda aziz
 
Ad

More from Dr. Girish GS (14)

Unix- the process
Unix-  the processUnix-  the process
Unix- the process
Dr. Girish GS
 
unix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grepunix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grep
Dr. Girish GS
 
unix- the process states, zombies, running jobs in background
unix-  the process states, zombies, running jobs in backgroundunix-  the process states, zombies, running jobs in background
unix- the process states, zombies, running jobs in background
Dr. Girish GS
 
Unix - Filters
Unix - FiltersUnix - Filters
Unix - Filters
Dr. Girish GS
 
Customizing the unix environment
Customizing the unix environmentCustomizing the unix environment
Customizing the unix environment
Dr. Girish GS
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodes
Dr. Girish GS
 
Basic regular expression, extended regular expression
Basic regular expression, extended regular expressionBasic regular expression, extended regular expression
Basic regular expression, extended regular expression
Dr. Girish GS
 
Logic instructions part 1
Logic instructions part 1Logic instructions part 1
Logic instructions part 1
Dr. Girish GS
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructions
Dr. Girish GS
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructions
Dr. Girish GS
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructions
Dr. Girish GS
 
Rotate instructions
Rotate instructionsRotate instructions
Rotate instructions
Dr. Girish GS
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructions
Dr. Girish GS
 
Memory interface
Memory interfaceMemory interface
Memory interface
Dr. Girish GS
 
unix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grepunix- Sort, uniq,tr,grep
unix- Sort, uniq,tr,grep
Dr. Girish GS
 
unix- the process states, zombies, running jobs in background
unix-  the process states, zombies, running jobs in backgroundunix-  the process states, zombies, running jobs in background
unix- the process states, zombies, running jobs in background
Dr. Girish GS
 
Customizing the unix environment
Customizing the unix environmentCustomizing the unix environment
Customizing the unix environment
Dr. Girish GS
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodes
Dr. Girish GS
 
Basic regular expression, extended regular expression
Basic regular expression, extended regular expressionBasic regular expression, extended regular expression
Basic regular expression, extended regular expression
Dr. Girish GS
 
Logic instructions part 1
Logic instructions part 1Logic instructions part 1
Logic instructions part 1
Dr. Girish GS
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructions
Dr. Girish GS
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructions
Dr. Girish GS
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructions
Dr. Girish GS
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructions
Dr. Girish GS
 
Ad

Recently uploaded (20)

How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 

Loop instruction, controlling the flow of progam

  • 1. Microprocessor & its Applications Module 3 Continued…… Dr. Girisha G S Dept. of CSE SoE, DSU, Bengaluru 1
  • 2. Agenda • LOOP instruction • Controlling the Flow of Program • Data declaration directives
  • 3. Syntax: LOOP Label - The instruction LOOP is used to execute a group of instruction repeatedly a specified number of times. - The CX register must be loaded with loop count (the number of times the LOOP is to be repeated). - When LOOP is executed, i) register CX is decremented by one automatically. ii) If CX != 0 it jumps to the address indicated by label. If CX becomes zero, execution will continue to the instruction following the LOOP. - The LOOP instruction is a combination of a decrement CX and the JNZ conditional jump. LOOP: Loop if CX not zero Example : calculate sum of 8bit numbers from 1-10 MOV AL,0 ; sum = AL MOB BL,1 ; first number=BL MOV CX, 0AH ; count=CX L1: ADD AL,BL ; accumulate sum in AX INC BL ; next number=BL LOOP L1 ; decrement CX until 0 DEC CX JNZ L1
  • 4. Controlling The Flow of an Assembly Language Program .IF-.ELSE-.ENDIF statement - Useful for making decision. General format of the .IF conditional statement: .IF (condition) …… .ELSE (optional) …… .ENDIF (end of if) - The assembly language also allows to use relational operator with .IF statement. - The table list the relational operators.
  • 5. Operator Function == equal to != not equal to > greater than < less than >= greater than or equal to <= less than or equal to & Bit test | OR ! logical inverter && logical AND || logical OR TITLE ”8086 ALP TO CONVERT LOWERCASE TO UPPER CASE” .MODEL SMALL .CODE MOV AX,@DATA MOV DS, AX MOV AH, 01H ; read character from keyboard in AL INT 21H .IF AL >=’a’ && AL <=’z’ ; if character is lower case , subtract 20H SUB AL, 20H .ENDIF MOV DL,AL ; display character on screen whose ascii code is stored in DL MOV AH,02H INT 21H MOV AH,4CH INT 21H END Example: - letters A through Z are represented as 41H through 5AH - letters a through z are represented as 61H through 7AH
  • 6. .WHILE-.ENDW statement Format of the while statement: .WHILE (CONDITION) ----------- ----------- .ENDW Example program: list all alphabets .MODEL .CODE MOV AX,@DATA MOV DS, AX MOV DL,’A’ .WHILE DL <= ’Z’ MOV AH,02H INT 21H INC DL .ENDW MOV AH,4CH INT 21H END - Test the loop condition before executing the loop body. The .ENDW directive marks the end of the loop
  • 7. .REPEAT-.UNTIL STATEMENT Format of the .repeat-.until while statement: .REPEAT ----------- ----------- .UNTIL (Condition) Example program : list all alphabets .MODEL .CODE MOV AX,@DATA MOV DS, AX MOV DL,’A’ .REPEAT MOV AH,02H INT 21H INC DL .UNTIL DL<=’Z’ MOV AH,4CH INT 21H END - Executes the loop body before testing the loop condition associated with .UNTIL directive
  • 8. Data Declaration Directives • DB The DB directive is used to declare a BYTE variable – A BYTE is made up of 8 bits. Examples: N1 DB 10h ; delcare and initialize 1 byte variable named N1 N2 DB ? ; declare 1 byte variable named N2 with no initial value LITST DB 21H,22H,23H,24H : declare an array LIST with 5 bytes and initializes with value LIST2 DB 10 DUP(?) ; declare an array of 10 bytes with no initial value S1 DB “Hello$” ; declare an array of 5 bytes and initialize with ASCII code of letters “Hello” • DW – The DW directive is used to declare a WORD type variable – A WORD occupies 16 bits or (2 BYTE). Examples: N2 DW 1234h Syntax: variable_name type initial_value [,initial_value]…… Syntax: variable_name type initial_value [,initial_value]……

Editor's Notes

  • #4: loops through a sequence of instructions until CX=0 The execution of the Loop instruction involves two steps: 1. First, it subtracts 1 from ECX. 2. Next, it compares ECX to zero.  If ECX is not equal to zero; a jump is taken to the label identified by destination.  Otherwise, if ECX equals zero, no jump takes place and control passes to the instruction following the loop.
  • #5: The if statement is used to conditionally execute a statement or a block of statements. Conditions can be true or false, execute one thing when the condition is true, something else when the condition is false. The expression after the 'if' is called the condition of the if statement. If the expression is evaluated to true, the statement(s) following 'if' clause execute and if the expression evaluates to a false value, the statement following the 'else' clause execute
  翻译: