NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl,00000001b neg bl; bl = 11111111 mov.

Slides:



Advertisements
Similar presentations
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.c: Logical Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
Advertisements

ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Computer Organization & Assembly Language
1 Multiplication, Division, and Numerical Conversions Chapter 6.
80x86 Instruction Set Dr. Qiang Lin.
1 Lecture 7 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
© 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.
Shift and Rotate Instructions
Practical Session 2. Labels Definition valid characters in labels are: letters, numbers, _, $, ~,., and ? first character can be: letter, _, ? and.
Practical Session 2. Labels Definition valid characters in labels are: letters, numbers, _, $, ~,., and ? first character can be: letter, _, ? and.
Assembly Language for Intel-Based Computers
Introduction to Computer Engineering by Richard E. Haskell Shift and Rotate Instructions Module M16.2 Section 10.3.
Ch. 7 Logic, Shift and Rotate instr.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
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.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Department of Computer Science and Software Engineering
Sahar Mosleh California State University San MarcosPage 1 Review.
Arithmetic Flags and Instructions
Integer Arithmetic Computer Organization and Assembly Languages Yung-Yu Chuang 2007/12/24 with slides by Kip Irvine.
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.
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.
Chapter 7: Integer Arithmetic. 2 Chapter Overview Shift and Rotate Instructions Shift and Rotate Applications Multiplication and Division Instructions.
Lecture 12 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly 06. Outline cmp (review) Jump commands test mnemonic bt mnemonic Addressing 1.
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.
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.
Boolean, Shift and Rotate instructions Dr.Hadi AL Saadi.
K.K. Leung Fall 2008Introductory Pentium Programming1 Pentium Architecture: Introductory Programming Kin K. Leung
Multiplication and Division instructions Dr.Hadi AL Saadi.
Practical Session 3 Computer Architecture and Assembly Language.
Computer Architecture and Assembly Language
Data Transfers, Addressing, and Arithmetic
Practical Session 2.
Microprocessor Systems Design I
Microprocessor Systems Design I
Chapter 3 Bit Operations
EE3541 Introduction to Microprocessors
Instruction System - Bit Manipulation Instruction
Machine control instruction
Assembly Language Programming Part 2
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
UNIT: 2 INSTRUCTION SET OF 8086.
CS 301 Fall 2002 Assembly Instructions
Practical Session 2.
Shift & Rotate Instructions)
ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition.
Shift & Rotate Instructions)
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5th Edition
Shift, Multiply, and Divide
Computer Architecture and System Programming Laboratory
EECE.3170 Microprocessor Systems Design I
Chapter 5 Arithmetic and Logic Instructions
Microprocessor and Assembly Language
Computer Organization and Assembly Language
Chapter 8: Instruction Set 8086 CPU Architecture
Shift and Rotate Instructions.
CS-401 Computer Architecture & Assembly Language Programming
Presentation transcript:

NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl, b neg bl; bl = mov ah, b neg ah; ah = mov al,-128 neg al ; al = 80h, OF=1

MUL and IMUL Instruction Multiplication operation to multiply two numbers Format : MUL Operand IMUL Operand where operand might be general register or memory MUL : for unsigned multiplication operation IMUL : for signed multiplication operation

MUL/IMUL result will be stored in : AX if byte type source DX:AX if word type source EDX:EAX if dword type source

DIV and IDIV Instruction Two division instruction: DIV operand : unsigned number IDIV operand: signed number Operand must be register or memory

Example DIV and IDIV Instruction DX = 0000h, AX = 0005h, BX = FFFEh: InstructionQuot.Rem.AXDX divbx idivbx-21FFFE0001 DX = FFFFh, AX = FFFBh, BX = 0002h: InstructionQuot.Rem.AXDX idivbx-2-1FFFEFFFF divbxDivide Overflow

Control bit instruction Logic instruction Shift instruction Rotate instruction

Logik instruction Table 1. Boolean Instructions

AND Operation Truth table which shows operation result of AND bit-1 bit-2 op-1: op-2: result:

Instruction Example and ax,bx and var1,edx and bl,var2 and dx,02FAh and al, b targetsource

OR Instruction Truth table which show OR operation result bit-1 bit-2 op-1: op-2: result:

Instruction example or ax,bx or var1,edx or bl,var2 or dx,02FAh or al, b targetsource

XOR Instruction Truth table shows XOR operation result bit-1 bit-2 op-1: op-2: result:

Instruction example mov al, b xor al, b ; AL = XORing any bit with 0 leaves the bit unchanged: mov al, b xor al, b ; AL =

Instruction example mov al, b xor al, b ; AL = xor al, b ; AL = same

NOT instruction Execute NOT operation at each bit at operand mov bh, b not bh; bh =

Shift instruction To shift one bit to left SHL O1, O2 –Each bit is shifted one place to the left –Right most will be filled with 0 –Bit output from left most is inserted to carry flag, CF (original CF content will disappear) –Example: mov bl,80h ; BX = 0080h shl bl,1 ; BX = 0000h, CF=1

Shift bit right To shift right, with method: SHR O1, O2 O1= first operand (general register or memory) O2= second operand (immediate or valid value) O1 content change after operation

SAL Instruction As SHL instruction Format –SAL O1, O2 O1= first operand, O2= second operand Eg: SAL AH,CL where AH=42H, CL=2 CF=0 –This instruction will caused 8-bit in AH is shifted 2- bit to the left. –Output bit at the right most is inserted to CF and bit which is emptied will be replaced by 0 –Last result, AH=O8H

SAR Instruction As in SHR Format –SAR O1,O2 O1= first operand, O2= second operand Eg: SAR AH, 1 where AH=35H, CF=0 This instruction will caused bit in AH is shifted 1-bit to the right Output bit is inserted to CF and empty bit is replace with sign bit Last result, AH=1AH

Rotate Instruction Similar to shift instruction, but rotate instruction will input again bit which has been exited at other end There are 4 instructions –ROR – rotate right –ROL – rotate left –RCR – rotate right with carry –RCL – rotate left with carry

ROR and ROL Instruction ROL rotate bits to the left Format : ROL O1, O2 ROR rotate bits to the right Format : ROR O1, O2 Final bit is also stored in CF

RCR and RCL Instruction RCL rotate left and take CF into consideration Format RCL O1, O2, RCR rotate right and take CF into consideration Format RCR O1, O2

Compare Instruction Its function is to set flag register as ready stae before conditional jump instruction is executed Format : CMP OD,OS ;OD= destination operand ;OS= source operand –Both operand must be general register, memory or immediate value

Flags Set by the CMP Instruction Signed: Unsigned:

Jump Instruction There are two jump instruction –Unconditional jump instruction –Conditional jump instruction Format –Arahan_Lompat label where Arahan_Lompat is an instruction label is the destination where jump will target program execution (label is a name not a register,memory or any value)

Some example of conditional jump instruction InstructionDescription JMPJump JAJump Above JAEJump Above or Equal JBJump Below JBEJump Below or Equal JCJump on Carry JCXZJump if CX register is Zero

Loop instruction One method that can represent high level language instruction such as “do_while” and “repeat_until” Format –LOOP Operand where Operand=label for instruction at the beginning of the loop Instructions will be executed until loop counter CX=0.

LOOP instruction variations InstructionDescription LOOPE/ LOOPZ LOOP while Equal/LOOP while Zero Jump to label if CX=0 and ZF=1 LOOPNE/ LOOPNZ LOOP while Not Equal/LOOP while Not Zero Jump to label if CX=0 and ZF=0