80x86 Instruction Set Dr. Qiang Lin.

Slides:



Advertisements
Similar presentations
Instruction Set of 8086 Engr. M.Zakir Shaikh
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,
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
Lecture 4 Basic Instructions Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Computer Organization & Assembly Language
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.
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
Microcomputer & Interfacing Lecture 3
Ch. 7 Logic, Shift and Rotate instr.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
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.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Department of Computer Science and Software Engineering
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.
ECE291 Computer Engineering II Lecture 4 Josh Potts University of Illinois at Urbana- Champaign.
1 Logic, Shift, and Rotate Instructions Read Sections 6.2, 7.2 and 7.3 of textbook.
Arithmetic and Logic Instructions. Outline Declarations Moving data The Flags register Logic instructions Addition & subtraction.
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
Lecture 12 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
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.
ECE291 Computer Engineering II Lecture 4 Josh Potts University of Illinois at Urbana- Champaign.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 1 Chapter Four.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Computer Architecture and Assembly Language
Chapter Nov-2010
Data Transfers, Addressing, and Arithmetic
16.317: Microprocessor System Design I
Today we are going to discuss about,
Microprocessor Systems Design I
ADDRESSING MODES.
Microprocessor and Assembly Language
EE3541 Introduction to Microprocessors
Instruction System - Bit Manipulation Instruction
Machine control instruction
Assembly IA-32.
INSTRUCTION SET.
Assembly Language Programming Part 2
ADDRESSING MODES.
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
UNIT: 2 INSTRUCTION SET OF 8086.
Symbolic Instruction and Addressing
CS 301 Fall 2002 Assembly Instructions
X86’s instruction sets.
Introduction to Assembly Language
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Data formats or Instruction formats of 8086:
Shift & Rotate Instructions)
Symbolic Instruction and Addressing
Shift & Rotate Instructions)
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5th Edition
Chapter 5 Arithmetic and Logic Instructions
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
Computer Organization and Assembly Language
CNET 315 Microprocessor & Assembly Language
Chapter 8: Instruction Set 8086 CPU Architecture
Shift and Rotate Instructions.
Presentation transcript:

80x86 Instruction Set Dr. Qiang Lin

Overview Most of assembler instructions presented are supported by all of the following Intel processors: 80186, 80286, 80386, 80486, Pentium (80586) Five major instruction categories: Transfer and Set Arithmetic Logic Jump Miscellaneous

80x86 Transfer & Set Instructions 1

Transfer Instructions Examples 1 MOV AX,0006h ; Move immediate data to AX register MOV BX,AX ; Move AX register data to BX register This small program moves the value of 0006H to the AX register, then it moves the content of AX (0006h) to the BX register Example 2: MOV AX,2000h ; Move immediate data to AX register MOV DS,AX ; Load DS segment register MOV SI, 100h ; Load immediate data to SI index register MOV DI, 120h ; Load immediate data to DI index register MOV CX, 10h ; Load immediate data to CX register MOV AH, [SI], ; Move memory data pointed by [SI] to AH register MOV [DI], AH ; Move AH register to memory located at [DI]

Set Instructions That Test Flags

Set Instructions for Unsigned Comparisons

Set Instructions for Signed Comparisons

Set Instructions Example Bool := ((A <= B) and (D = E)) or (F <> G) MOV AX, A CMP AX, B SETLE BL MOV AX, D CMP AX, E SETE BH AND BL, BH MOV AX, F CMP AX, G SETNE BH OR BL, BH MOV Bool, BH

80x86 Transfer Instructions 2

Transfer Instructions Examples 2 PUSH DS ; Push current DS content to stack MOV AX,0 ; Move immediate data to AX register PUSH AX ; Push 0 to stack MOV AL, 0A1H CBW CWD Example 2: IN AL, 60h ; Read keyboard port MOV DX,378h ; Point at LPT1: data port IN AL, DX ; Read data from printer port INC AX ; Bump ASCII code by one OUT DX, AL ; Write data in AL to printer port

80x86 String (Transfer) Instructions 3

80x86 Arithmetic Instructions 1

Arithmetic Instructions Examples 1 Example 1: J = K + M MOV AX, K ADD AX,M MOV J, AX Example 2: J = K + M + N + P ADD AX,N ADD AX,P

Arithmetic Instructions Examples 2 Example 1: J = K - J MOV AX, K SUB J, AX MOV J, AX Example 1: J = J - (K + M) MOV AX, J SUB AX, K SUB AX, M or ADD AX, M

80x86 Arithmetic Instructions 2

Arithmetic Instructions Examples 3 Example 1: ((J*7 + K) * 6 + M) * 2 MOV BX, J IMUL BX, 7 ADD BX, K IMUL BX, 6 ADD BX, M ADD BX, BX Example 2: J = K/ M (unsigned) MOV AX, K MOV DX, 0 ; Zero extend unsigned value in AX to DX DIV M MOV J, AX

80x86 Arithmetic Instructions 3

SHL\SAL\SAR Instructions Move each bit in destination operand one bit to left by No. of times specified by count operand Zeros fill vacated positions at L.O. bit; H.O. bit shifts into carry flag SHL AH, 4 ; Move L.O. bits to H.O. position SAR Move each bit in destination operand one bit to right by No. of times specified by count operand H.O. bit fills vacated position at H.O. bit; L.O. bit shifts into carry flag SAR AH, 4

RCL\RCR\ROL\ROR Instructions

80x86 Logic Instructions 1

80x86 Logic Instructions 2 Except NOT, AND, OR and XOR instructions affect flags as follows: Clear carry flag Clear overflow flag Set zero flag if result is zero and clear it otherwise Copy H.O. bit of result into sign flag Set parity flag according to parity (number of one bits) in result Scramble auxiliary carry flag NOT instruction does not affect any flags

SHR\SHLD\SHRD Instructions Provide double precision shift left and right operations, respectively Available only on 80386 and later processors with forms of SHLD operand1, operand2, immediate SHLD operand1, operand2, CL SHRD operand1, operand2, immediate SHRD operand1, operand2, CL

SHRD Instruction Example Let ax contains a value in range 0..99 representing a year (1900..1999) bx contains a value in the range 1..31 representing a day, and cx contains a value in the range 1..12 representing a month Pack these data into dx as follows: SHRD DX, AX, 7 SHRD DX, BX, 5 SHRD DX, CX, 4

80x86 Miscellaneous Instructions LEA - Loads specified 16 or 32 bit general purpose register with effective address of the specified memory location using formats of: LEA reg16, mem or LEA reg32, mem (only for 80386 or later processors) Examples: LEA AX, [BX] LEA BX, 3[BX] LEA AX, 3[BX] LEA BX, 4[BP+SI] LEA AX, -123[DI]

80x86 General Jump Instructions 1

80x86 General Jump Instructions 2

80x86 Unsigned Jump (Cardinal) Instructions

80x86 Signed Jump (Integer) Instructions

Jump Instructions Examples 1 POP AX JMP AX CALL SUB CALL DwordTbl[BX] SUB: PUSH AX PUSH BX …. POP BX RET