Exp 6

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

BOOLEAN OPERATORS

Experiment 6
Objective
• To learn how to use Boolean operators in assembly language
Introduction to Boolean Operators
• Boolean operators work on a bitwise level between two operands.
• The results are stored in the destination operand.
• Common Boolean operations include:
AND, OR, XOR, NOT, NEG
AND & OR
AND Instruction
•Performs a bitwise AND between two operands.
• Syntax: AND dest, source
Example: AND AL, BL (Result is stored in AL)

OR Instruction
• Performs a bitwise OR between two operands.
• Syntax: OR dest, source
Example: OR AL, BL
XOR, NOT & NEG
XOR Instruction
•Performs a bitwise XOR between two operands.
• Syntax: XOR dest, source
Example: XOR AL, BL (Result is stored in AL)

NOT Instruction NEG Instruction


• Toggles all bits of the operand. • Computes the two's complement,
• Syntax: NOT dest making the operand negative.
Example: NOT AL • Syntax: NEG dest
Example: NOT AL
Example
ORG 100h
.DATA
num1 DB 10
num2 DB 5
.CODE
NEG num2 ; Compute the two's complement
of num2 (i.e., -5)
MOV AL, num1 ; Load num1 into AL
ADD AL, num2 ; Add num2 (now negative) to
num1
Tasks
1. In the following instruction sequence. Show the changed value of AL
where indicated, in binary:
mov a1, 00001111b
and al, 00111011b
mov al, 6Dh
and al, 4Ah
mov al, 00001111b
or al, 61h
mov al, 94h
xor al, 37h
Tasks
2. In the following instruction sequence, show the changed value of AL
where indicated, in hexadecimal:
mov al, 7Ah
not al
mov al, 3Dh
and al,74h
mov al,9bh
or al,35h
mov al,72h
xor al, odch

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy