SlideShare a Scribd company logo
1 of 19
W E L C O M E T O O U R
P R E S E N TAT I O N
Logical, Shift, and Rotate Instruction
CONTENT:
• Logical instruction(AND, OR, XOR, NOT) with example.
• Shift instruction
• Rotate instruction
• Converting ASCII code
LOGICAL INSTRUCTION:
Logical table of and, or, xor, and not gate:
a b a AND b a OR b a XOR b
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
a NOT a
0 1
1 0
LOGICAL AND:
1 0 1 0 1 0 1 0
1 1 1 1 0 0 0 0
00 0 001 0
0
1
1
0
0
1
0 1 1 0 1 1 1 0
1 0 1 1 0 0 1 1
11 1 111 1
0
1
1
0
1
1
ZF:
SF:
PF:
CF:
OF:
ZF:
SF:
PF:
CF:
OF:
LOGICAL OR:
1 0 1 0 1 0 1 0
1 1 0 1 0 0 0 1
11 0 111 1
0
1
0
0
0
1
0 1 1 0 1 0 1 0
1 0 1 1 0 0 1 1
00 0 100 0
0
0
0
0
1
1
ZF:
SF:
PF:
CF:
OF:
ZF:
SF:
PF:
CF:
OF:
LOGICAL XOR:
1 0 1 0 1 0 1 0
1 1 1 1 0 0 1 1
11 0 010 1
0
0
1
0
1
0
0 1 1 0 1 0 1 1
1 0 1 1 0 1 1 1
01 1 011 1
0
1
1
0
1
0
ZF:
SF:
PF:
CF:
OF:
ZF:
SF:
PF:
CF:
OF:
LOGICAL NOT:
1 0 1 0 1 0 1 0
11 1 000 1 0
1 1 0 0 1 1 1 0
11 0 000 0 1
0
0
1
0
1
0
0
0
0
1
ZF:
SF:
PF:
CF:
OF:
ZF:
SF:
PF:
CF:
OF:
AND, OR INSTRUCTION EXAMPLE:
Example-1: Clear the sign bit of AL while leaving the other bits unchanged
Solution: Use the AND instruction with 01111111b=7FH as the mask. Thus,
AND AL,7FH
Example-2: Set the most significant and least significant bits of AL while
preserving the other bits.
Solution: Use the QR instruction with 10000001b = 81h as the mask .Thus ,
OR AL , 81h
CONVERTING:
• Converting an ASCII Digit to a Number:
• Converting a Lowercase to a Uppercase:
• Clearing a register:
For example ,if the “5” key is pressed, AL gets 35h instead of 5.to get 5 in
AL ,we could do this..
SUB AL , 30h
SUB DL,20h
We already know two ways to clear a resister. For example, to clear AX we
could execute..
MOV AX,0 or SUB AX ,AX
SHIFT INSTRUCTION:
• SHL and
SAL
• SHR
• SAR
ROTATE INSTRUCTION:
• ROL
• ROR
• RCL
• RCR
SHIFT INSTRUCTION: SHL AND SAL
• The SHL (shift left ) instruction shifts the bits in the destination to the left.
• A 0 is shifted into the right most bit position and the msb is shifted into CF.
0 1 1 0 0 1 0 1
00100 1
0000 0
0
CF
CF
11 1-S
2-S1111
0
0
SHIFT INSTRUCTION: SHR
• The instruction SHR(shift right) performs right shift on the destination operand.
• A 0 is shifted into the msb position ,and the rightmost bit is shifted into CF.
0 1 1 0 0 1 0 1
00000
000 00 0
1 1 1 1
1 1 1
1-S
2-S
CF
CF
0
0
SHIFT INSTRUCTION: SAR
• The SAR instruction (shift arithmetic right) operates like SHR, with one
difference: the msb retains its original value.
0 1 1 0 0 1 0 1
00000
000 00 0
1 1 1 1
1 1 1
1-S
2-S
CF
CF
ROTATE INSTRUCTION: ROL
• The instruction ROL (rotate left )shifts bits to the left .The msb is shifted into
the rightmost bit . The CF also gets the bit shifted out of the msb .
0 1 1 0 0 1 0 1
000 1
1000
0 1111
11111
CF
CF
1-S
2-S
ROTATE INSTRUCTION: ROR
• The instruction ROR (rotate right ) works just like ROL , except that the bits are
rotate to the right .The rightmost bit is shifted into the msb , and also into The CF.
0 1 1 0 0 1 0 1
00000
000 01 0
1 1 1 1
1 1 1
1-S
2-S
CF
CF
ROTATE INSTRUCTION: RCL
0 1 1 0 0 1 0 1
000 0
1000
1111
0111
1
0
• The instruction RCL (Rotate through carry left ) shifts the bits of the
destination to the left. The msb is shifted
into the CF, and the previous value of CF is shifted into the rightmost bit.
1-S
2-S
ROTATE INSTRUCTION: RCR
0 1 1 0 0 1 0 1
0000
00 00
1 1 1
1 1 1
1-S
2-S
0
1
1
1
The instruction RCR( Rotate through carry right) works just like RCL,
except that the bits are rotated to the right.
CF
THANK YOU.

More Related Content

What's hot

Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor Mustapha Fatty
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructionsDr. Girish GS
 
8086 instructions
8086 instructions8086 instructions
8086 instructionsRavi Anand
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086Mahalakshmiv11
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086Dr. AISHWARYA N
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSORAkhila Rahul
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxImranBhatti58
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085ShivamSood22
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086aviban
 

What's hot (20)

Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Subroutine
SubroutineSubroutine
Subroutine
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructions
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
DAA AND DAS
DAA AND DASDAA AND DAS
DAA AND DAS
 
Micro program example
Micro program exampleMicro program example
Micro program example
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSOR
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptx
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Arithmetic and logical instructions
Arithmetic and logical instructionsArithmetic and logical instructions
Arithmetic and logical instructions
 

Similar to Logical, Shift, and Rotate Instruction

Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions setRobert Almazan
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructionsRobert Almazan
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Bilal Amjad
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptxNishatNishu5
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instructionkashif Shafqat
 
Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Irfan Anjum
 
Logic microoperations
Logic microoperationsLogic microoperations
Logic microoperationsNitesh Singh
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051logesh waran
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructionsihsanjamil
 
Assembly language-lab9
Assembly language-lab9Assembly language-lab9
Assembly language-lab9AjEcuacion
 

Similar to Logical, Shift, and Rotate Instruction (20)

Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Chapter3 8086inst logical 2
Chapter3 8086inst logical 2Chapter3 8086inst logical 2
Chapter3 8086inst logical 2
 
Chap3 8086 logical
Chap3 8086 logicalChap3 8086 logical
Chap3 8086 logical
 
8086inst logical
8086inst logical8086inst logical
8086inst logical
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
 
Copy of 8086inst logical
Copy of 8086inst logicalCopy of 8086inst logical
Copy of 8086inst logical
 
Copy of 8086inst logical
Copy of 8086inst logicalCopy of 8086inst logical
Copy of 8086inst logical
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
Logic Micro Operation
Logic Micro OperationLogic Micro Operation
Logic Micro Operation
 
logical 8051
logical 8051logical 8051
logical 8051
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 
Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)
 
Logic microoperations
Logic microoperationsLogic microoperations
Logic microoperations
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
 
Shift register
Shift registerShift register
Shift register
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Assembly language-lab9
Assembly language-lab9Assembly language-lab9
Assembly language-lab9
 

More from Badrul Alam

E filling system (report)
E filling system (report)E filling system (report)
E filling system (report)Badrul Alam
 
E file(final-defense)
E file(final-defense)E file(final-defense)
E file(final-defense)Badrul Alam
 
E filling system (report)
E filling system (report)E filling system (report)
E filling system (report)Badrul Alam
 
E file (title-defense)
E file (title-defense)E file (title-defense)
E file (title-defense)Badrul Alam
 
E file(pre-defense)
E file(pre-defense)E file(pre-defense)
E file(pre-defense)Badrul Alam
 
Albert einstein presentation
Albert einstein presentationAlbert einstein presentation
Albert einstein presentationBadrul Alam
 
Fedora os presentation
Fedora os presentationFedora os presentation
Fedora os presentationBadrul Alam
 
Security features of fedora
Security features of fedoraSecurity features of fedora
Security features of fedoraBadrul Alam
 
Factorial number in linux shell.
Factorial number in linux shell. Factorial number in linux shell.
Factorial number in linux shell. Badrul Alam
 
Simulation of Queueing Systems(Single-Channel Queue).
Simulation of Queueing Systems(Single-Channel Queue).Simulation of Queueing Systems(Single-Channel Queue).
Simulation of Queueing Systems(Single-Channel Queue).Badrul Alam
 
Longest Common Sub-sequence (LCS)
Longest Common Sub-sequence (LCS)Longest Common Sub-sequence (LCS)
Longest Common Sub-sequence (LCS)Badrul Alam
 
Equivalence and minimization of DFA
Equivalence and minimization of DFAEquivalence and minimization of DFA
Equivalence and minimization of DFABadrul Alam
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationLoop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationBadrul Alam
 
Error Detection and Correction presentation
Error Detection and Correction presentation Error Detection and Correction presentation
Error Detection and Correction presentation Badrul Alam
 
Networking assignment
Networking assignmentNetworking assignment
Networking assignmentBadrul Alam
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagramBadrul Alam
 
Automatic light control Using LDR
Automatic light control Using LDRAutomatic light control Using LDR
Automatic light control Using LDRBadrul Alam
 
Pipeline processing and generation of computer.
Pipeline processing and generation of computer.Pipeline processing and generation of computer.
Pipeline processing and generation of computer.Badrul Alam
 

More from Badrul Alam (18)

E filling system (report)
E filling system (report)E filling system (report)
E filling system (report)
 
E file(final-defense)
E file(final-defense)E file(final-defense)
E file(final-defense)
 
E filling system (report)
E filling system (report)E filling system (report)
E filling system (report)
 
E file (title-defense)
E file (title-defense)E file (title-defense)
E file (title-defense)
 
E file(pre-defense)
E file(pre-defense)E file(pre-defense)
E file(pre-defense)
 
Albert einstein presentation
Albert einstein presentationAlbert einstein presentation
Albert einstein presentation
 
Fedora os presentation
Fedora os presentationFedora os presentation
Fedora os presentation
 
Security features of fedora
Security features of fedoraSecurity features of fedora
Security features of fedora
 
Factorial number in linux shell.
Factorial number in linux shell. Factorial number in linux shell.
Factorial number in linux shell.
 
Simulation of Queueing Systems(Single-Channel Queue).
Simulation of Queueing Systems(Single-Channel Queue).Simulation of Queueing Systems(Single-Channel Queue).
Simulation of Queueing Systems(Single-Channel Queue).
 
Longest Common Sub-sequence (LCS)
Longest Common Sub-sequence (LCS)Longest Common Sub-sequence (LCS)
Longest Common Sub-sequence (LCS)
 
Equivalence and minimization of DFA
Equivalence and minimization of DFAEquivalence and minimization of DFA
Equivalence and minimization of DFA
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationLoop(for, while, do while) condition Presentation
Loop(for, while, do while) condition Presentation
 
Error Detection and Correction presentation
Error Detection and Correction presentation Error Detection and Correction presentation
Error Detection and Correction presentation
 
Networking assignment
Networking assignmentNetworking assignment
Networking assignment
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagram
 
Automatic light control Using LDR
Automatic light control Using LDRAutomatic light control Using LDR
Automatic light control Using LDR
 
Pipeline processing and generation of computer.
Pipeline processing and generation of computer.Pipeline processing and generation of computer.
Pipeline processing and generation of computer.
 

Recently uploaded

Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 

Recently uploaded (20)

Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 

Logical, Shift, and Rotate Instruction

  • 1. W E L C O M E T O O U R P R E S E N TAT I O N
  • 2. Logical, Shift, and Rotate Instruction
  • 3. CONTENT: • Logical instruction(AND, OR, XOR, NOT) with example. • Shift instruction • Rotate instruction • Converting ASCII code
  • 4. LOGICAL INSTRUCTION: Logical table of and, or, xor, and not gate: a b a AND b a OR b a XOR b 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 a NOT a 0 1 1 0
  • 5. LOGICAL AND: 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 00 0 001 0 0 1 1 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 1 11 1 111 1 0 1 1 0 1 1 ZF: SF: PF: CF: OF: ZF: SF: PF: CF: OF:
  • 6. LOGICAL OR: 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 1 11 0 111 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 00 0 100 0 0 0 0 0 1 1 ZF: SF: PF: CF: OF: ZF: SF: PF: CF: OF:
  • 7. LOGICAL XOR: 1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 11 0 010 1 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 01 1 011 1 0 1 1 0 1 0 ZF: SF: PF: CF: OF: ZF: SF: PF: CF: OF:
  • 8. LOGICAL NOT: 1 0 1 0 1 0 1 0 11 1 000 1 0 1 1 0 0 1 1 1 0 11 0 000 0 1 0 0 1 0 1 0 0 0 0 1 ZF: SF: PF: CF: OF: ZF: SF: PF: CF: OF:
  • 9. AND, OR INSTRUCTION EXAMPLE: Example-1: Clear the sign bit of AL while leaving the other bits unchanged Solution: Use the AND instruction with 01111111b=7FH as the mask. Thus, AND AL,7FH Example-2: Set the most significant and least significant bits of AL while preserving the other bits. Solution: Use the QR instruction with 10000001b = 81h as the mask .Thus , OR AL , 81h
  • 10. CONVERTING: • Converting an ASCII Digit to a Number: • Converting a Lowercase to a Uppercase: • Clearing a register: For example ,if the “5” key is pressed, AL gets 35h instead of 5.to get 5 in AL ,we could do this.. SUB AL , 30h SUB DL,20h We already know two ways to clear a resister. For example, to clear AX we could execute.. MOV AX,0 or SUB AX ,AX
  • 11. SHIFT INSTRUCTION: • SHL and SAL • SHR • SAR ROTATE INSTRUCTION: • ROL • ROR • RCL • RCR
  • 12. SHIFT INSTRUCTION: SHL AND SAL • The SHL (shift left ) instruction shifts the bits in the destination to the left. • A 0 is shifted into the right most bit position and the msb is shifted into CF. 0 1 1 0 0 1 0 1 00100 1 0000 0 0 CF CF 11 1-S 2-S1111 0 0
  • 13. SHIFT INSTRUCTION: SHR • The instruction SHR(shift right) performs right shift on the destination operand. • A 0 is shifted into the msb position ,and the rightmost bit is shifted into CF. 0 1 1 0 0 1 0 1 00000 000 00 0 1 1 1 1 1 1 1 1-S 2-S CF CF 0 0
  • 14. SHIFT INSTRUCTION: SAR • The SAR instruction (shift arithmetic right) operates like SHR, with one difference: the msb retains its original value. 0 1 1 0 0 1 0 1 00000 000 00 0 1 1 1 1 1 1 1 1-S 2-S CF CF
  • 15. ROTATE INSTRUCTION: ROL • The instruction ROL (rotate left )shifts bits to the left .The msb is shifted into the rightmost bit . The CF also gets the bit shifted out of the msb . 0 1 1 0 0 1 0 1 000 1 1000 0 1111 11111 CF CF 1-S 2-S
  • 16. ROTATE INSTRUCTION: ROR • The instruction ROR (rotate right ) works just like ROL , except that the bits are rotate to the right .The rightmost bit is shifted into the msb , and also into The CF. 0 1 1 0 0 1 0 1 00000 000 01 0 1 1 1 1 1 1 1 1-S 2-S CF CF
  • 17. ROTATE INSTRUCTION: RCL 0 1 1 0 0 1 0 1 000 0 1000 1111 0111 1 0 • The instruction RCL (Rotate through carry left ) shifts the bits of the destination to the left. The msb is shifted into the CF, and the previous value of CF is shifted into the rightmost bit. 1-S 2-S
  • 18. ROTATE INSTRUCTION: RCR 0 1 1 0 0 1 0 1 0000 00 00 1 1 1 1 1 1 1-S 2-S 0 1 1 1 The instruction RCR( Rotate through carry right) works just like RCL, except that the bits are rotated to the right. CF