ARITHMETIC AND LOGIC
INSTRUCTIONS
Dr. OMAR ABDULLAH AL-NAGGAR
CONTENTS







Introduction to Arithmetic and logic operations.
Arithmetic operations.
80XArithmetic instruction.
Logical operations.
80X86 Logic instructions.
80X86 Logic shift instructions.
Applications of Arithmetic & Logic in MPS & MCS.
INTRODUCTION TO ARITHMETIC AND
LOGIC OPERATIONS



Arithmetic and logic operations are fundamental concepts in mathematics and
computer science. These operations form the foundation of computations and
decision-making processes in various fields, from basic calculations to complex
algorithms.
Arithmetic operations deal with basic mathematical computations. These are used to
perform numerical calculations and manipulate values.
Logic operations, also known as Boolean operations, involve manipulating true or
false values (binary values: 1 or 0). These operations are essential in decision-making,
computer circuits, and programming.
INTRODUCTION TO ARITHMETIC AND
LOGIC OPERATIONS









Arithmetic Operations in Computing:
Used in all kinds of mathematical computations for the following:
Calculating totals, averages, and other statistical measures.
Financial applications like interest computation, tax calculation, and budgeting.
Arithmetic operations are used to transform and manipulate data for analysis.
Scaling data: Multiplication and division adjust data ranges
Offset adjustments: Addition and subtraction shift data values.
Arithmetic operations used in in Graphics and Image processing for image scaling,
transformations and pixel intensity adjustment.
Arithmetic is fundamental to algorithms for sorting, searching, and optimizing data.
INTRODUCTION TO ARITHMETIC AND
LOGIC OPERATIONS






Logic Operations in Computing:
Logic operations are at the heart of decision-making and control flow in computing.
They process Boolean data (true/false) to guide how a program operates.
Logical gates (AND, OR, NOT, XOR) are the building blocks of digital circuits in CPUs,
memory, and other hardware components.
Example: A CPU uses these gates to perform operations like addition, subtraction, and logical
comparisons
Logic operations allow for filtering data based on conditions
Example: A search query might use logical operations to find items that satisfy multiple
criteria.
INTRODUCTION TO ARITHMETIC AND
LOGIC OPERATIONS








Combination of Arithmetic and Logic in computing:
Computing often involves a combination of arithmetic and logic operations for
complex tasks.
Sorting Algorithms:
Compare values using logic operations and rearrange them using arithmetic.
Encryption and Cryptography:
Use both types of operations to secure data
Artificial Intelligence (AI):
Logical rules decide actions based on processed numerical data (e.g., weights in neural
networks)
INTRODUCTION TO ARITHMETIC AND
LOGIC OPERATIONS




Why Are These Operations Essential?
Efficiency:
Arithmetic and logic operations are executed quickly and efficiently by CPUs, enabling
real-time processing
Versatility:
They are applicable across all areas of computing, from simple calculators to AI
systems.
Fundamental to Programming:
Virtually all programming tasks, from database management to game development,
rely on these operations.
ARITHMETIC OPERATIONS









Arithmetic operations are used to perform numerical calculations and manipulate
values. The primary arithmetic operations are:
Addition (+): Combines two numbers to get their sum.
Example: 5+3=85 + 3 = 85+3=8
Subtraction (−): Calculates the difference between two numbers.
Example: 7−2=57 - 2 = 57−2=5
Multiplication (×): Computes the product of two numbers.
Example: 4×3=124 × 3 = 124×3=12
Division (÷): Divides one number by another to find the quotient.
Example: 8÷2=48 ÷ 2 = 48÷2=4
80X86 ARITHMETIC
INSTRUCTIONS










Arithmetic instructions:
ADD ( unsigned Addition)
SYNTAX: ADD destination, source
Adds two operands and stores the result in the destination operand.
Operands can be registers, memory locations, or immediate values
Example:
MOV AX, 1234H ; Load AX with 1234H
ADD AX, 4321H ; AX = AX + 4321H (AX = 5555H)
CARRY:
occurs when result of addition exceed the max value that can represent in destination register for
16bit reg max value is FFFFh(65535) in decimal. if the sum of two 16bit exceed this value the carry
will set.
80X86 ARITHMETIC
INSTRUCTIONS








SUB (unsigned Subtraction)
SYNTAX: SUB destination, source
Subtracts the source operand from the destination operand and stores the result in
the destination.
Example:
MOV AX, 1234H ; Load AX with 1234H
SUB AX, 0022H ; AX = AX - 0022H (AX = 1212H)
NOTE:
Unsigned subtraction means when the result of subtraction return a positive value. If
the result of subtraction is a negative (signed value) we will use SBB instruction.
80X86 ARITHMETIC
INSTRUCTIONS








SBB (Subtract with Borrow)
SYNTAX: SBB destination, source
Subtracts the source operand and the Carry Flag (CF) from the destination operand.
Used when we subtract low data FROM high data Ex: 10-20= -10 this operation called
subtraction with borrow.
Used in multi-byte or multi-word subtraction.
Example:
MOV AX, 2345H ; Load AX with 1000H
SBB AX, 4567H ; AX = 9029 in decimal(2345) - 17767 in decimal (4567) = -8738(DDDE)
80X86 ARITHMETIC
INSTRUCTIONS











MUL (Unsigned Multiplication)
SYNTAX: MUL operand
Multiplies an unsigned operand (+) with the accumulator (AL or AX).
The operand here can be
Single-byte operand: AL × Operand → AX
Word operand: AX × Operand → DX:AX (result stored in DX:AX, DX holds the high word).
Example:
MOV AX, 1234H ; Load AX with 1234h
MOV BX, 1234H ; Load BX with 1234h
MUL BX ; Multiply AX by BX (AX = AX * BX) ; AX = AX * BX (AX = 1234H * 1234H)
Consider the result of this operation will be two word 16-bit data, so the result will stored in DX which
holds the higher word and AX will holds the lower word.
80X86 ARITHMETIC
INSTRUCTIONS










DIV (Unsigned Division)
SYNTAX: DIV operand
Divides the accumulator (AX or DX:AX) by the specified operand.
The operand can be:
Byte operand: AX ÷ Operand → Quotient in AL, Remainder in AH.
Word operand: DX:AX ÷ Operand → Quotient in AX, Remainder in DX.
Example:
MOV AX, 0014H ; Load AX with 20
MOV BL, 05H ; Load BL with 5
DIV BL ; AX ÷ BL → AL = 4 (quotient), AH = 0 (remainder)
80X86 ARITHMETIC
INSTRUCTIONS












INC (Increment)
SYNTAX: INC operand
Increases the value of the operand by 1
Example:
MOV AX, 1234H ; Load AX with 1234H
INC AX ; AX = AX + 1 (AX = 1235H)
DEC (Decrement)
SYNTAX: DEC operand
Decreases the value of the operand by 1.
Example:
MOV AX, 1234H ; Load AX with 1234H
DEC AX ; AX = AX - 1 (AX = 1233H)
LOGICAL OPERATIONS




Logic operations
also known as Boolean operations, involve manipulating true or false values (binary
values: 1 or 0). These operations are essential in decision-making, computer circuits,
and programming. The primary logic operations include:
AND :Returns true if both operands are true. OR : Returns true if at least one
operand is true.
Truth Table Truth Table:
OUTPUT B A
0 0 0
0 1 0
0 0 1
1 1 1
OUTPUT B A
0 0 0
1 1 0
1 0 1
1 1 1
LOGICAL OPERATIONS




NOT operation: Inverts the truth value of a single operand.
Truth table
XOR operation: Returns true if exactly one operand is true.
Truth Table: OUTPUT B A
0 0 0
1 1 0
1 0 1
0 1 1
OUTPUT A
1 0
0 1
80X86 LOGICAL INSTRUCTIONS







AND (Logical AND)
SYNTAX: AND destination operand, source operand
Performs a bitwise AND operation between two operands and the result store in
distention operand.
The AND logic similar to multiplication of binary (*) when two operands are 1 AND
return 1 other wise 0.
Example:
MOV AL, 0F0H ; Load AL with 11110000B (B for binary)
AND AL, 0F5H Binary Hexadecimal
11110000 0F0
11110101 0F5
11110000 0F0 result
80X86 LOGICAL INSTRUCTIONS







OR (Logical OR)
SYNTAX: OR destination operand, source operand
Performs a bitwise OR operation between two operands and the result stored in the
destination.
The OR logic similar to addition of binary (+) Returns true if at least one operand is
true.
Example:
MOV AL, 0F0H ; Load AL with 11110000B
OR AL, 0F5H Binary Hexadecimal
11110000 0F0
11110101 0F5
11110101 0F5 result
80X86 LOGICAL INSTRUCTIONS







XOR (Exclusive OR):
SYNTAX: XOR destination operand, source operand
Performs a bitwise XOR operation between two operands and the result stored in
distention.
XOR return 1 when both inputs are different.
Example:
MOV AL, 0F0H ; Load AL with 11110000B
XOR AL, 0F5H ; Binary Hexadecimal
11110000 0F0
11110101 0F5
00000101 005 result
80X86 LOGICAL INSTRUCTIONS







NOT (Logical not)
SYNTAX: NOT destination operand
Performs a bitwise NOT (inversion) on a single operand.
Inverts the value of a single operand when if its 1 NOT return 0 and if 0 it return 1.
Example:
MOV AL, 0F0H ; Load AL with 11110000B
NOT AL Binary Hexadecimal
11110000 0F0
00001111 00F result
80X86 LOGICAL INSTRUCTIONS









Shift Instructions
Shift instructions move bits within an operand to the left or right. The number of shifts is
specified either by 1 or by the value in the CL register.
Logical shifts move bits left or right, filling the vacated(MSB|LSB) bits with zeros.
MSB (Most Significant Bit):
Definition: The MSB is the highest-order bit in a binary number. It represents the largest value in the
binary system for the given bit length.
Position: It is the leftmost bit in a binary number (firest digit of binary from left).
LSB (Least Significant Bit):
Definition: The LSB is the lowest-order bit in a binary number. It represents the smallest value
(either 0 or 1).
Position: It is the rightmost bit in a binary number (last digit of binary from left to right )
0 is shifted into the least significant bit (LSB)
80X86 LOGICAL INSTRUCTIONS











SHR (Shift Right)
Logical shifts move bits Right, filling the vacated bits with zeros.
The LSB (Least Significant Bit) is shifted right out of the register and moved to the Carry Flag (CF).
A digit 0 is inserted into the MSB (Most Significant Bit).
SYNTAX: SHR destination, count
Example:
MOV AL, 0F0H ; Load AL with 11110000B
SHR AL, 1 ; AL will be 011110000B (70h)
The LSB (Least Significant Bit) is shifted right out of the register and moved to the Carry Flag (CF).
A digit 0 is shifted into the most significant bit (MSB).
The carry flag (CF) is 0 because the LSB shifted out was 0.
80X86 LOGICAL INSTRUCTIONS











SHL (Shift Left)
Logical shifts move bits left, filling the vacated bits with zeros.
The MSB (Most Significant Bit) is shifted out of the register and moved into the Carry Flag (CF).
A digit 0 is inserted into the LSB (Least Significant Bit).
SYNTAX: SHL destination, count
Example:
MOV AL, 0F0H ; Load AL with 11110000B
SHL AL, 1 ; AL = 11100000B (0E0H)
The MSB (Most Significant Bit) is shifted out of the register and moved into the Carry Flag (CF).
A digit 0 is shifted into the least significant bit (LSB)
The carry flag (CF) is 1 because the MSB shifted out was 1.
APPLICATIONS OF ARITHMETIC & LOGIC IN MPS &
MCS.








Applications of Arithmetic operation in MPS & MCS.
Data processing:
Example: In a digital thermometer, the microcontroller may add sensor offsets to correct
temperature readings
Signal Processing
Used in embedded systems like audio players or communication devices for operations such
as filtering, averaging, and scaling signals.
Timer and Counter
Arithmetic operations calculate delays, timing intervals, and frequencies
Example: Generating PWM (Pulse Width Modulation) signals for motor control
APPLICATIONS OF ARITHMETIC & LOGIC IN MPS &
MCS.









Applications of Logic operation in MPS & MCS.
Decision Making:
Logic operations evaluate conditions to make decisions in real-time
Example: A smart lock system uses AND/OR logic to grant access only if the correct code and
fingerprint are provided.
Interrupt Handling:
Microcontrollers use logic to decide whether an interrupt condition is met.
Example: Triggering an alarm if temperature exceeds a certain threshold.
Digital Signal Processing (DSP):
Logic operations are used to implement filters, encoders, and decoders in embedded
communication systems.
THANK YOU…

More Related Content

PPT
RTL,Instruction set _
PPT
microp-8085 74 instructions for mct-A :P
PPT
microp-8085 74 instructions for mct-A :P-2
PPT
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
PPT
Unit 2 8086 Instruction set.ppt notes good
PPTX
Instruction set 8085
PPT
8085 paper-presentation
PPT
8085 micro processor
RTL,Instruction set _
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P-2
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
Unit 2 8086 Instruction set.ppt notes good
Instruction set 8085
8085 paper-presentation
8085 micro processor

Similar to Arthimatic_logical like the subtraction and additional.pdf (20)

PPT
8085-paper-presentation.ppt
PPT
instruction-set-of-8086-mr-binu-joy3.ppt
PPT
Low Level Prog. (from 201-c).ppt
PDF
Assembly language-lab9
DOCX
Instruction set of 8086
PDF
Instructionsetof8086 180224060745(3)
PPTX
EPC Module-5 ES.pptxModule-5 ES.pptxModule-5 ES.pptx
PPSX
Dsp Datapath
PDF
Lecture 03 Arithmetic Group of Instructions
PDF
8085 Architecture
PDF
Introduction to 8085 by adi ppt
PDF
Intrl 8086 instruction set
PDF
BISWAJIT ADHIKARI_28101623024_PC EE 602.pdf
PPTX
MPMC-3.pptxMicroprocessor and microcontroller programming
PPTX
Arithmetic Operations in Assembly Language: Fundamentals & Implementation
PPTX
5th unit Microprocessor 8085
PDF
15CS44 MP & MC Module 2
PPTX
Mod-2.pptx
PPTX
Instruction sets of 8086.pptxXXcxxxxxxxxxxxxxxxxxx
PPTX
X86 operation types
8085-paper-presentation.ppt
instruction-set-of-8086-mr-binu-joy3.ppt
Low Level Prog. (from 201-c).ppt
Assembly language-lab9
Instruction set of 8086
Instructionsetof8086 180224060745(3)
EPC Module-5 ES.pptxModule-5 ES.pptxModule-5 ES.pptx
Dsp Datapath
Lecture 03 Arithmetic Group of Instructions
8085 Architecture
Introduction to 8085 by adi ppt
Intrl 8086 instruction set
BISWAJIT ADHIKARI_28101623024_PC EE 602.pdf
MPMC-3.pptxMicroprocessor and microcontroller programming
Arithmetic Operations in Assembly Language: Fundamentals & Implementation
5th unit Microprocessor 8085
15CS44 MP & MC Module 2
Mod-2.pptx
Instruction sets of 8086.pptxXXcxxxxxxxxxxxxxxxxxx
X86 operation types
Ad

Recently uploaded (20)

PDF
Microsoft Office 365 Crack Download Free
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Computer Software - Technology and Livelihood Education
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PPTX
Introduction to Windows Operating System
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
Website Design Services for Small Businesses.pdf
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Microsoft Office 365 Crack Download Free
Wondershare Recoverit Full Crack New Version (Latest 2025)
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
CCleaner 6.39.11548 Crack 2025 License Key
GSA Content Generator Crack (2025 Latest)
iTop VPN Crack Latest Version Full Key 2025
Computer Software - Technology and Livelihood Education
Visual explanation of Dijkstra's Algorithm using Python
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Practical Indispensable Project Management Tips for Delivering Successful Exp...
Introduction to Windows Operating System
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
DNT Brochure 2025 – ISV Solutions @ D365
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
"Secure File Sharing Solutions on AWS".pptx
Website Design Services for Small Businesses.pdf
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Ad

Arthimatic_logical like the subtraction and additional.pdf

  • 1. ARITHMETIC AND LOGIC INSTRUCTIONS Dr. OMAR ABDULLAH AL-NAGGAR
  • 2. CONTENTS        Introduction to Arithmetic and logic operations. Arithmetic operations. 80XArithmetic instruction. Logical operations. 80X86 Logic instructions. 80X86 Logic shift instructions. Applications of Arithmetic & Logic in MPS & MCS.
  • 3. INTRODUCTION TO ARITHMETIC AND LOGIC OPERATIONS    Arithmetic and logic operations are fundamental concepts in mathematics and computer science. These operations form the foundation of computations and decision-making processes in various fields, from basic calculations to complex algorithms. Arithmetic operations deal with basic mathematical computations. These are used to perform numerical calculations and manipulate values. Logic operations, also known as Boolean operations, involve manipulating true or false values (binary values: 1 or 0). These operations are essential in decision-making, computer circuits, and programming.
  • 4. INTRODUCTION TO ARITHMETIC AND LOGIC OPERATIONS          Arithmetic Operations in Computing: Used in all kinds of mathematical computations for the following: Calculating totals, averages, and other statistical measures. Financial applications like interest computation, tax calculation, and budgeting. Arithmetic operations are used to transform and manipulate data for analysis. Scaling data: Multiplication and division adjust data ranges Offset adjustments: Addition and subtraction shift data values. Arithmetic operations used in in Graphics and Image processing for image scaling, transformations and pixel intensity adjustment. Arithmetic is fundamental to algorithms for sorting, searching, and optimizing data.
  • 5. INTRODUCTION TO ARITHMETIC AND LOGIC OPERATIONS       Logic Operations in Computing: Logic operations are at the heart of decision-making and control flow in computing. They process Boolean data (true/false) to guide how a program operates. Logical gates (AND, OR, NOT, XOR) are the building blocks of digital circuits in CPUs, memory, and other hardware components. Example: A CPU uses these gates to perform operations like addition, subtraction, and logical comparisons Logic operations allow for filtering data based on conditions Example: A search query might use logical operations to find items that satisfy multiple criteria.
  • 6. INTRODUCTION TO ARITHMETIC AND LOGIC OPERATIONS         Combination of Arithmetic and Logic in computing: Computing often involves a combination of arithmetic and logic operations for complex tasks. Sorting Algorithms: Compare values using logic operations and rearrange them using arithmetic. Encryption and Cryptography: Use both types of operations to secure data Artificial Intelligence (AI): Logical rules decide actions based on processed numerical data (e.g., weights in neural networks)
  • 7. INTRODUCTION TO ARITHMETIC AND LOGIC OPERATIONS     Why Are These Operations Essential? Efficiency: Arithmetic and logic operations are executed quickly and efficiently by CPUs, enabling real-time processing Versatility: They are applicable across all areas of computing, from simple calculators to AI systems. Fundamental to Programming: Virtually all programming tasks, from database management to game development, rely on these operations.
  • 8. ARITHMETIC OPERATIONS          Arithmetic operations are used to perform numerical calculations and manipulate values. The primary arithmetic operations are: Addition (+): Combines two numbers to get their sum. Example: 5+3=85 + 3 = 85+3=8 Subtraction (−): Calculates the difference between two numbers. Example: 7−2=57 - 2 = 57−2=5 Multiplication (×): Computes the product of two numbers. Example: 4×3=124 × 3 = 124×3=12 Division (÷): Divides one number by another to find the quotient. Example: 8÷2=48 ÷ 2 = 48÷2=4
  • 9. 80X86 ARITHMETIC INSTRUCTIONS           Arithmetic instructions: ADD ( unsigned Addition) SYNTAX: ADD destination, source Adds two operands and stores the result in the destination operand. Operands can be registers, memory locations, or immediate values Example: MOV AX, 1234H ; Load AX with 1234H ADD AX, 4321H ; AX = AX + 4321H (AX = 5555H) CARRY: occurs when result of addition exceed the max value that can represent in destination register for 16bit reg max value is FFFFh(65535) in decimal. if the sum of two 16bit exceed this value the carry will set.
  • 10. 80X86 ARITHMETIC INSTRUCTIONS         SUB (unsigned Subtraction) SYNTAX: SUB destination, source Subtracts the source operand from the destination operand and stores the result in the destination. Example: MOV AX, 1234H ; Load AX with 1234H SUB AX, 0022H ; AX = AX - 0022H (AX = 1212H) NOTE: Unsigned subtraction means when the result of subtraction return a positive value. If the result of subtraction is a negative (signed value) we will use SBB instruction.
  • 11. 80X86 ARITHMETIC INSTRUCTIONS         SBB (Subtract with Borrow) SYNTAX: SBB destination, source Subtracts the source operand and the Carry Flag (CF) from the destination operand. Used when we subtract low data FROM high data Ex: 10-20= -10 this operation called subtraction with borrow. Used in multi-byte or multi-word subtraction. Example: MOV AX, 2345H ; Load AX with 1000H SBB AX, 4567H ; AX = 9029 in decimal(2345) - 17767 in decimal (4567) = -8738(DDDE)
  • 12. 80X86 ARITHMETIC INSTRUCTIONS            MUL (Unsigned Multiplication) SYNTAX: MUL operand Multiplies an unsigned operand (+) with the accumulator (AL or AX). The operand here can be Single-byte operand: AL × Operand → AX Word operand: AX × Operand → DX:AX (result stored in DX:AX, DX holds the high word). Example: MOV AX, 1234H ; Load AX with 1234h MOV BX, 1234H ; Load BX with 1234h MUL BX ; Multiply AX by BX (AX = AX * BX) ; AX = AX * BX (AX = 1234H * 1234H) Consider the result of this operation will be two word 16-bit data, so the result will stored in DX which holds the higher word and AX will holds the lower word.
  • 13. 80X86 ARITHMETIC INSTRUCTIONS           DIV (Unsigned Division) SYNTAX: DIV operand Divides the accumulator (AX or DX:AX) by the specified operand. The operand can be: Byte operand: AX ÷ Operand → Quotient in AL, Remainder in AH. Word operand: DX:AX ÷ Operand → Quotient in AX, Remainder in DX. Example: MOV AX, 0014H ; Load AX with 20 MOV BL, 05H ; Load BL with 5 DIV BL ; AX ÷ BL → AL = 4 (quotient), AH = 0 (remainder)
  • 14. 80X86 ARITHMETIC INSTRUCTIONS             INC (Increment) SYNTAX: INC operand Increases the value of the operand by 1 Example: MOV AX, 1234H ; Load AX with 1234H INC AX ; AX = AX + 1 (AX = 1235H) DEC (Decrement) SYNTAX: DEC operand Decreases the value of the operand by 1. Example: MOV AX, 1234H ; Load AX with 1234H DEC AX ; AX = AX - 1 (AX = 1233H)
  • 15. LOGICAL OPERATIONS     Logic operations also known as Boolean operations, involve manipulating true or false values (binary values: 1 or 0). These operations are essential in decision-making, computer circuits, and programming. The primary logic operations include: AND :Returns true if both operands are true. OR : Returns true if at least one operand is true. Truth Table Truth Table: OUTPUT B A 0 0 0 0 1 0 0 0 1 1 1 1 OUTPUT B A 0 0 0 1 1 0 1 0 1 1 1 1
  • 16. LOGICAL OPERATIONS     NOT operation: Inverts the truth value of a single operand. Truth table XOR operation: Returns true if exactly one operand is true. Truth Table: OUTPUT B A 0 0 0 1 1 0 1 0 1 0 1 1 OUTPUT A 1 0 0 1
  • 17. 80X86 LOGICAL INSTRUCTIONS        AND (Logical AND) SYNTAX: AND destination operand, source operand Performs a bitwise AND operation between two operands and the result store in distention operand. The AND logic similar to multiplication of binary (*) when two operands are 1 AND return 1 other wise 0. Example: MOV AL, 0F0H ; Load AL with 11110000B (B for binary) AND AL, 0F5H Binary Hexadecimal 11110000 0F0 11110101 0F5 11110000 0F0 result
  • 18. 80X86 LOGICAL INSTRUCTIONS        OR (Logical OR) SYNTAX: OR destination operand, source operand Performs a bitwise OR operation between two operands and the result stored in the destination. The OR logic similar to addition of binary (+) Returns true if at least one operand is true. Example: MOV AL, 0F0H ; Load AL with 11110000B OR AL, 0F5H Binary Hexadecimal 11110000 0F0 11110101 0F5 11110101 0F5 result
  • 19. 80X86 LOGICAL INSTRUCTIONS        XOR (Exclusive OR): SYNTAX: XOR destination operand, source operand Performs a bitwise XOR operation between two operands and the result stored in distention. XOR return 1 when both inputs are different. Example: MOV AL, 0F0H ; Load AL with 11110000B XOR AL, 0F5H ; Binary Hexadecimal 11110000 0F0 11110101 0F5 00000101 005 result
  • 20. 80X86 LOGICAL INSTRUCTIONS        NOT (Logical not) SYNTAX: NOT destination operand Performs a bitwise NOT (inversion) on a single operand. Inverts the value of a single operand when if its 1 NOT return 0 and if 0 it return 1. Example: MOV AL, 0F0H ; Load AL with 11110000B NOT AL Binary Hexadecimal 11110000 0F0 00001111 00F result
  • 21. 80X86 LOGICAL INSTRUCTIONS          Shift Instructions Shift instructions move bits within an operand to the left or right. The number of shifts is specified either by 1 or by the value in the CL register. Logical shifts move bits left or right, filling the vacated(MSB|LSB) bits with zeros. MSB (Most Significant Bit): Definition: The MSB is the highest-order bit in a binary number. It represents the largest value in the binary system for the given bit length. Position: It is the leftmost bit in a binary number (firest digit of binary from left). LSB (Least Significant Bit): Definition: The LSB is the lowest-order bit in a binary number. It represents the smallest value (either 0 or 1). Position: It is the rightmost bit in a binary number (last digit of binary from left to right ) 0 is shifted into the least significant bit (LSB)
  • 22. 80X86 LOGICAL INSTRUCTIONS            SHR (Shift Right) Logical shifts move bits Right, filling the vacated bits with zeros. The LSB (Least Significant Bit) is shifted right out of the register and moved to the Carry Flag (CF). A digit 0 is inserted into the MSB (Most Significant Bit). SYNTAX: SHR destination, count Example: MOV AL, 0F0H ; Load AL with 11110000B SHR AL, 1 ; AL will be 011110000B (70h) The LSB (Least Significant Bit) is shifted right out of the register and moved to the Carry Flag (CF). A digit 0 is shifted into the most significant bit (MSB). The carry flag (CF) is 0 because the LSB shifted out was 0.
  • 23. 80X86 LOGICAL INSTRUCTIONS            SHL (Shift Left) Logical shifts move bits left, filling the vacated bits with zeros. The MSB (Most Significant Bit) is shifted out of the register and moved into the Carry Flag (CF). A digit 0 is inserted into the LSB (Least Significant Bit). SYNTAX: SHL destination, count Example: MOV AL, 0F0H ; Load AL with 11110000B SHL AL, 1 ; AL = 11100000B (0E0H) The MSB (Most Significant Bit) is shifted out of the register and moved into the Carry Flag (CF). A digit 0 is shifted into the least significant bit (LSB) The carry flag (CF) is 1 because the MSB shifted out was 1.
  • 24. APPLICATIONS OF ARITHMETIC & LOGIC IN MPS & MCS.         Applications of Arithmetic operation in MPS & MCS. Data processing: Example: In a digital thermometer, the microcontroller may add sensor offsets to correct temperature readings Signal Processing Used in embedded systems like audio players or communication devices for operations such as filtering, averaging, and scaling signals. Timer and Counter Arithmetic operations calculate delays, timing intervals, and frequencies Example: Generating PWM (Pulse Width Modulation) signals for motor control
  • 25. APPLICATIONS OF ARITHMETIC & LOGIC IN MPS & MCS.          Applications of Logic operation in MPS & MCS. Decision Making: Logic operations evaluate conditions to make decisions in real-time Example: A smart lock system uses AND/OR logic to grant access only if the correct code and fingerprint are provided. Interrupt Handling: Microcontrollers use logic to decide whether an interrupt condition is met. Example: Triggering an alarm if temperature exceeds a certain threshold. Digital Signal Processing (DSP): Logic operations are used to implement filters, encoders, and decoders in embedded communication systems.