Lecture 5 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.

Slides:



Advertisements
Similar presentations
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Advertisements

NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl, b neg bl; bl = mov.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.c: Logical Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Computer Organization & Assembly Language
80x86 Instruction Set Dr. Qiang Lin.
Lecture 2 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 5 Arithmetic and Logic Instructions.
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 10: Flag control instructions Conditional execution.
Ch. 5 from Yu & Marut. Registers 14(16-bit) registers: 1.Data reg. – to hold data for an op. 2.Address reg – to hold addr of an instruction or data.
Ch. 7 Logic, Shift and Rotate instr.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Lecture 05: Assembly Language Programming (2). The 80x86 IBM PC and Compatible Computers Chapter 3 Arithmetic & Logic Instructions and Programs Chapter.
Lecture 13 Basic I/O Interface
11.1/36 Repeat: From Bits and Pieces Till Strings.
Lecture 3 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Types of Registers (8086 Microprocessor Based)
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.
Lecture 4 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Lecture 4 ( Assembly Language).
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
5. Assembly Language. Basics of AL Program data Pseudo-ops Array Program structures Data, stack, code segments.
Arithmetic Flags and Instructions
1 Logic, Shift, and Rotate Instructions Read Sections 6.2, 7.2 and 7.3 of textbook.
Logical and Bit Operations Chapter 9 S. Dandamudi.
EEL 3801 Part V Conditional Processing. This section explains how to implement conditional processing in Assembly Language for the 8086/8088 processors.
LEA instruction The LEA instruction can be used to get the offset address of a variable Example ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it.
Lecture 12 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Introduction to Computer Organization and Assembly Language
The Assemble, Unassemble commands of the debugger: U Command for converting machine code language source Equivalent machine code instructions Equivalent.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
Lecture 9 Design of the Computer Instruction Set and the CPU Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Microprocessor & Assembly Language
Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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.
Boolean, Shift and Rotate instructions Dr.Hadi AL Saadi.
Computer Architecture CST 250
Chapter Nov-2010
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Lecture 4 Control Flow Structures (LOOPS)
Microprocessor Systems Design I
EE3541 Introduction to Microprocessors
Instruction System - Bit Manipulation Instruction
Machine control instruction
INSTRUCTION SET.
More on logical instruction and
Assembly Language Programming Part 2
ECE 353 Introduction to Microprocessor Systems
Intel 8088 (8086) Microprocessor Structure
Lecture 4 ( Assembly Language).
Shift & Rotate Instructions)
Shift & Rotate Instructions)
Shift, Multiply, and Divide
Microprocessor and Assembly Language
Computer Organization and Assembly Language
CNET 315 Microprocessor & Assembly Language
Chapter 8: Instruction Set 8086 CPU Architecture
Shift and Rotate Instructions.
CS-401 Computer Architecture & Assembly Language Programming
Ch. 5 – Intel 8086 – study details from Yu & Marut
Presentation transcript:

Lecture 5 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU

Agenda Logic Instructions – AND, OR, XOR and NOT TEST Instruction Shift and Rotate Instructions Stack Operations Introduction to Procedures

AND, OR and XOR Instructions AND destination, source OR destination, source XOR destination, source Memory-to-memory operations are not allowed Effect on flags – SF, ZF, PF reflect the result – AF is undefined – CF, OF = 0

Use of Logic Instructions Selectively modify the bits of destination – b AND 1 = b(b represents a bit, 0/1) – b AND 0 = 0 – b OR 0 = b – b OR 1 = 1 – b XOR 0 = b – b XOR 1 = ~b (complement of b) So, AND cab be used to clear specific destination bit OR can be used to set specific destination bit XOR can be used to complement specific destination bit

Examples Example 7.2: Clear the sign bit of AL while leaving the other bits unchanged. AND AL, 7Fh Example 7.3: Set the msb and lsb of AL while preserving the other bits. ORAL, 81h Example 7.4: Change the sign bit of DX XOR DX, 8000h = 7Fh = 81h

NOT Instruction Complement operation NOT destination Example 7.5: Complement the bits in AX NOTAX

Agenda Logic Instructions – AND, OR, XOR and NOT TEST Instruction Shift and Rotate Instructions Stack Operations Introduction to Procedures

TEST Instruction TEST performs AND on the destination TEST destination, source Effects on flags – SF, ZF, PF reflect the result – AF is undefined – CF, OF = 0 TEST vs. CMP – CMP is subtraction operation

TEST Example Jump to label BELOW if AL contains an even number TESET AL, 1; is AL even? JZBELOW; yes, go to BELOW

Agenda Logic Instructions – AND, OR, XOR and NOT TEST Instruction Shift and Rotate Instructions Stack Operations Introduction to Procedures

Shift and Rotate Instructions Two types of shift and rotate instructions – Logical Shift / Rotate – Arithmetic Shift/Rotate Both logical and arithmetic left shift are identical But right shifts are different

Shift and Rotate Instructions SHL DH, 3; DH = DH = C = 1 SAL DH, 2; DH = DH = C = 1 SHR DH, 3; DH = DH = C = 1 SAR DH, 2; DH = DH = C = 1

Rotate Instructions Let DH = 8Ah = CF = 1 After first RCR DH = CF = 0 After second RCR DH = CF = 1

Agenda Logic Instructions – AND, OR, XOR and NOT TEST Instruction Shift and Rotate Instructions Stack Operations Introduction to Procedures

Stack vs. Queue Stack – LIFO : Last In First Out Queue – FIFO : First In First Out Stack Queue

PUSH vs. POP in Stack

Stack Operations

PUSH Instructions

POP Instructions

Stack example

Agenda Logic Instructions – AND, OR, XOR and NOT TEST Instruction Shift and Rotate Instructions Stack Operations Introduction to Procedures

Procedure Example Product = 0 REPEAT IF lsb of B is 1 THEN product = product + A END_IF Shift left A Shift right B UNTIL B = 0

References Ch 7, Assembly Language Programming – by Charls Marut Ch 4, Intel Microprocessors – by Brey