Download presentation
Presentation is loading. Please wait.
Published byAde Santoso Modified over 6 years ago
1
CS-401 Computer Architecture & Assembly Language Programming
Lecture-12 Bits Manipulation
2
Lets revise the last lecture
3
Lets revise the last lecture.
4
Extended Shift num1: dd 40000 sh1 word [num1+2],1 rc1 word [num1],1
Shift Right num1: dd 40000 sh1 word [num1+2],1 rc1 word [num1],1 num1 + 2 num1
5
Types of Logical Operations
6
Bitwise Logical Operators
and and performs the logical bitwise ‘and’ of two operands (byte or word) and return the result to the destination operand. A bit in the result is set if both corresponding bits of the original operands are set. Otherwise the result bit is cleared. Flags affected: C O P S Z A and ax, bx and byte [num], 5 Truth table X Y X and Y 1
7
Bitwise Logical Operators
or performs the logical bitwise ‘Inclusive or’ of two operands (byte or word) and return the result to the destination operand. A bit in the result is set if either or both corresponding bits of the original operands are set. Otherwise the result bit is cleared. Flags affected: C O P S Z A or ax, bx or byte [num], 5 Truth table X Y X or Y 1
8
Bitwise Logical Operators
xor xor performs the logical bitwise ‘Exclusive or’ of two operands (byte or word) and return the result to the destination operand. A bit in the result is set if the corresponding bits of the original operands contains opposite values. Otherwise the result bit is cleared. Flags affected: C O P S Z A xor ax, bx xor byte [num], 5 Truth table X Y X xor Y 1
9
Bitwise Logical Operators
not not inverts the bits (forms the 1’s complement) of the word or byte operand. Flags affected: NONE not ax not cl not byte [num] Truth table X not X 1
10
Masking Bits and and al, 0x0F 1 0 1 0 1 0 1 0 AL = 0xAA
mask = 0x0F AL = 0x0A
11
Masking Bits or or al, 0xF0 1 0 1 0 1 0 1 0 AL = 0xAA 1 1 1 1 0 0 0 0
mask = 0xF0 AL = 0x0A
12
Masking Bits xor xor al, 0xF0 1 0 1 0 1 0 1 0 AL = 0xAA
mask = 0xF0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.