CS-401 Computer Architecture & Assembly Language Programming

Slides:



Advertisements
Similar presentations
COMP3221 lec9-logical-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 9: C/Assembler Logical and Shift - I
Advertisements

1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.c: Logical Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
COMP3221: Microprocessors and Embedded Systems--Lecture 7 1 COMP3221: Microprocessors and Embedded Systems Lecture 7: Arithmetic and logic Instructions.
Logical, Shift, and Rotate Operations CS208. Logical, Shift and Rotate Operations  A particular bit, or set of bits, within the byte can be set to 1.
Logical and Shift operations A particular bit, or set of bits, within the byte is set to 1 or 0 depending on conditions encountered during the execution.
Review Two’s complement
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
24/06/2015CSE1303 Part B lecture notes 1 Words, bits and pieces Lecture B05 Lecture notes section B05.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Bit Operations C is well suited to system programming because it contains operators that can manipulate data at the bit level –Example: The Internet requires.
A bit can have one of two values: 0 or 1. The C language provides four operators that can be used to perform bitwise operations on the individual bits.
Ch. 7 Logic, Shift and Rotate instr.
MICRO OPERATIONS Department of Computer Engineering, M.S.P.V.L. Polytechnic College, Pavoorchatram.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To be able to use the bitwise logical operators in programs ❏ To be able to use.
Bits and Bytes. BITWISE OPERATORS Recall boolean logical operators in Java… boolean logical operators: &, |, ^ not: ! Show truth tables.
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
CSC 270 – Survey of Programming Languages C Lecture 5 – Bitwise Operations and Operations Miscellany.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Department of Computer Science and Software Engineering
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Logic (continuation) Boolean Logic and Bit Operations.
Bitwise Operators Fall 2008 Dr. David A. Gaitros
Bit Operations Horton pp Why we need to work with bits Sometimes one bit is enough to store your data: say the gender of the student (e.g. 0.
Logic Conditional Processing. Status flags - review The Zero flag is set when the result of an operation equals zero. The Carry flag is set when an instruction.
1 Logic, Shift, and Rotate Instructions Read Sections 6.2, 7.2 and 7.3 of textbook.
Assembly 05. Outline Bit mapping Boolean logic (review) Bitwise logic Bit masking Bit shifting Lookup table 1.
EEL 3801 Part V Conditional Processing. This section explains how to implement conditional processing in Assembly Language for the 8086/8088 processors.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
Memory and the Character Display Chapter 10. The Bitwise Operators The bitwise operators are used to access the computer hardware. Use of bitwise operators.
The inverter performs the Boolean NOT operation. When the input is LOW, the output is HIGH; when the input is HIGH, the output is LOW. The Inverter AX.
Microprocessor & Assembly Language
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Bitwise and Logical Manipulations Assembly Language Programming University of Akron Dr. Tim Margush.
Windows Programming Lecture 06. Data Types Classification Data types are classified in two categories that is, – those data types which stores decimal.
Bit Operations Horton pp
Overview Register Transfer Language Register Transfer
Chapter 3 Bit Operations
Bitwise Logic and Immediate Operands
More on logical instruction and
CS-401 Computer Architecture & Assembly Language Programming
CS-401 Computer Architecture Assembly Language Programming
CS-401 Assembly Language Programming
CS 240 – Lecture 8 Bitwise Operations, Bit Manipulation, Type Conversion, Conditional Expression.
CS-401 Computer Architecture & Assembly Language Programming
The 8051 Assembly Language Arithmetic & Logic Instructions
Logic Bitwise Instructions
Chapter 14 Bitwise Operators Objectives
REGISTER TRANSFER LANGUAGE
The University of Adelaide, School of Computer Science
Introduction to Programming
CS-401 Computer Architecture & Assembly Language Programming
Bitwise Operators CS163 Fall 2018.
Shift & Rotate Instructions)
Shift & Rotate Instructions)
Homework Homework Continue Reading K&R Chapter 2 Questions?
CS 206D Computer Organization
University of Gujrat Department of Computer Science
CS-401 Assembly Language Programming
CS-401 Computer Architecture & Assembly Language Programming
Bitwise Operators.
CS-401 Computer Architecture & Assembly Language Programming
Microprocessor and Assembly Language
Computer Organization and Assembly Language
CS-401 Computer Architecture and Assembly Language Programming
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Bit Manipulations CS212.
CS-401 Computer Architecture & Assembly Language Programming
Bit Operations Horton pp
Presentation transcript:

CS-401 Computer Architecture & Assembly Language Programming Lecture-12 Bits Manipulation

Lets revise the last lecture

Lets revise the last lecture.

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

Types of Logical Operations

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

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

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

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

Masking Bits and and al, 0x0F 1 0 1 0 1 0 1 0 AL = 0xAA 0 0 0 0 1 1 1 1 mask = 0x0F 0 0 0 0 1 0 1 0 AL = 0x0A

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 1 1 1 1 1 0 1 0 AL = 0x0A

Masking Bits xor xor al, 0xF0 1 0 1 0 1 0 1 0 AL = 0xAA 1 1 1 1 0 0 0 0 mask = 0xF0 0 1 0 1 1 0 1 0