ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition.

Slides:



Advertisements
Similar presentations
Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors: 8086/8088, 80186/80188,
Advertisements

Introduction to Computer Engineering by Richard E. Haskell BCD Arithmetic Module M16.5 Section 10.4.
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 x86’s instruction sets. 2 Instruction Set Classification  Transfer Move  Arithmetic Add / Subtract Mul / Div, etc.  Control Jump Call / Return, etc.
Department of Computer Science and Software Engineering
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Computer Organization & Assembly Language
80x86 Instruction Set Dr. Qiang Lin.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
1 Lecture 7 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
ADD Instruction ADD destination,source ADD AX,BX ADD SUM,EAX
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.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Shift and Rotate Instructions
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
Microcomputer & Interfacing Lecture 3
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers
Integer Arithmetic COE 205 Computer Organization and Assembly Language
Introduction to Computer Engineering by Richard E. Haskell Shift and Rotate Instructions Module M16.2 Section 10.3.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Flag Control instructions CLC clear carry flag CF = 0 STC set carry flag CF= 1 CMC complement carry flag [CF] CF.
11.1/36 Repeat: From Bits and Pieces Till Strings.
ASCII and BCD Arithmetic Chapter 11 S. Dandamudi.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 1 Chapter.
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.b: Arithmetic Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
Integer Arithmetic Computer Organization and Assembly Languages Yung-Yu Chuang 2007/12/24 with slides by Kip Irvine.
CT215: Assembly Language Programming
Assembly Language for Intel-Based Computers, 4 th Edition Unpacked and Packed Integers (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for x86 Processors 6th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify and copy.
Arithmetic and Logic Instructions
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.
Arithmetic Flags and Instructions Chapter 7 S. Dandamudi.
Irvine, Kip R. Assembly Language for Intel-Based Computers. Chapter 7: Integer Arithmetic Slides to Accompany Assembly Language for Intel-Based Computers,
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for x86 Processors 7th Edition
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 Arithmetic and logical Instructions.
Computer Architecture and Assembly Language
Chapter Nov-2010
Assembly Language for Intel-Based Computers, 5th Edition
Assembly Language for x86 Processors 7th Edition
Instruction Set of 8086 Microprocessor
Microprocessor Systems Design I
Microprocessor Systems Design I
INSTRUCTION SET.
Assembly Language Programming Part 2
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
CS 301 Fall 2002 Assembly Instructions
X86’s instruction sets.
Chapter 4: Instructions
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/11/17
Data formats or Instruction formats of 8086:
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5th Edition
Shift, Multiply, and Divide
Chapter 5 Arithmetic and Logic Instructions
UNIT-II Assembly Language Programs Involving Logical
Chapter 5: Arithmetic and Logic Instructions
Presentation transcript:

ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition. ADD BL,76H BL=BL+76H 3. Memory-to Register addition. ADD [BX+DI],DL [BX+DI]=[BX+DI]+DL Array Addition. ADD AL,ARRAY[SI] AL=AL+ARRAY[SI]

Increment Addition. INC CX CX=CX+1 INC WORD PTR[SI] INC [DI] 6. Addition-with Carry. ADC AL,BL AL= AL + BL+ carry 7. Exchange and Add (80486-Pentium 4) XADD BL,AL BL=BL+AL , AL=BL

SUBTRACTION Register Subtraction. SUB BL,DL BL=BL-DL Immediate Subtraction. SUB BH,76H BH=BH-76H Decrement Subtraction. DEC BL BL=BL-1 DEC DWORD PTR[EBP] DEC [DI] Subtraction-with-Borrow. SBB AX,BX AX=AX-BX-Borrow

COMPARISON CMP DX,AX DX-AX Flag Changed CMP BX,1234H BX-1234H Flag Changed CMP CL,[BP] CL-[BP] Flag Changed Compare and Exchange (80486-Pentium 4). CMPXCHG CX,DX if CX=AX AX=DX if CX≠AX AX=CX

MULTIPLICATION AND DIVISION 8-bit Multiplication. MUL DL AX=AL*DL Unsigned IMUL CH AX=AL*CH Signed 16-bit Multiplication. MUL CX (DX-AX)=AX*CX Unsigned IMUL SI (DX-AX)=AX*SI Signed 32-bit Multiplication. MUL ECX (EDX-EAX)=EAX*ECX Unsigned IMUL ESI (EDX-EAX)=EAX*ESI Signed

DIVISION IDIV BL AL=S-quotient( AX/BL) 8-bit Division. DIV CL AL=Uns-quotient( AX/CL) AH=Uns-remainder( AX/CL) IDIV BL AL=S-quotient( AX/BL) AH=S-remainder( AX/BL) 2. 16-bit Division. DIV CX AX=Uns-quotient( DX-AX/CX) DX=Uns-remainder( DX-AX/CX) IDIV SI AX=S-quotient( DX-AX/CX) DX=S-remainder( DX-AX/CX) 3. 32-bit Division. DIV ECX EAX=Uns-quotient (EDX-EAX/ECX) EDX=Uns-remainder( EDX-EAX/ECX) IDIV DATA EAX=S-quotient (EDX-EAX/[DATA]) EDX=S-remainder( EDX-EAX/[DATA])

BCD and ARITHMETIC BCD Arithmetic. DAA (decimal adjust after addition). MOV BX,1234H MOV DX,5678H MOV AL,BL ADD AL,DL DAA (adjustment function only with the AL) DAS (decimal adjust after subtraction) SUB AL,DL DAS (adjustment function only with the AL)

ASCII Arithmetic. Function with ASCII-coded numbers (30H-39H) AAA (ASCII adjust after addition) MOV AX,31H ADD AL,39H AAA if result<10 AH=0,if greater AH=AH+1 ADD AX,3030H AAD (ASCII adjust before division) MOV BL,9 MOV AX,702H AAD convert the unpacked BCD (00-99) into binary DIV BL

AAM (ASCII adjust after multiplication) MOV AL,5 MOV CL,5 MUL CL AAM AL=reminder(AX/10), AH=quotient(AX/10) AAS (ASCII adjust after subtraction) MOV AX,39H SUB AL,33H AAS

BASIC LOGIC INSTRUCTIONS AND. AND AX,BX AX=AX and BX OR. OR AL,BH AL=AL or BH EXCLUSIVE-OR. XOR CH,DL CH=CH xor DL

4. Test and Bit Test Instructions. TEST DL,DH DL and DH BT BX,3 tests a bit position 3, carry=b2 BTC AX,4 tests a bit position 4, carry=b3, b3=b3 BTR DX,2 test a bit position 2, carry=b1, b1=0 BTS CX,13 test a bit position 13, carry=b12, b12=1 5. NOT and NEG. NOT CL CL=CL NEG CL CL=CL +1

SHIFT and ROTATE Shift. SHL AX,1 SAL BX,1 SHR ECX,14 SAR SI,CL D-P-SH (80386-P4) SHRD AX,BX,10 SHLD EBX,ECX,18 C SHL SAL SHR SAR

Rotate. RCL AL,1 ROL EDX,20 RCR AH,CL ROR WORD PTR[BP],4 Bit Scan Instructions (80386-P4) BSF EBX,EAX BSR EBX,EAX C RCL ROL RCR ROR

STRING COMPARISONS String scan instruction. compares the AL register with a byte block of memory, the AX with a word block of memory or the EAX with a doubleword block of memory. SCASB AL-ES:[DI] DI=DI±1 SCASW AX-ES:[DI] DI=DI±2 SACSD EAX-ES:[DI] DI=DI±4 Compare strings instruction. compares two sections of memory data as byte, word, doubleword. CMPSB DS:[SI] -ES:[DI] SI=SI±1,DI=DI±1 CMPSW DS:[SI] -ES:[DI] SI=SI±2,DI=DI±2 CMPSD DS:[SI] -ES:[DI] SI=SI±4,DI=DI±4