16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 8: Data Transfer Instructions.

Slides:



Advertisements
Similar presentations
Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Advertisements

There are two types of addressing schemes:
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
8-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 4: 80386DX memory, addressing.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
The Pentium Processor.
The Pentium Processor Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
The Pentium Processor Chapter 3 S. Dandamudi.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Microprocessor Microprocessor (cont..) It is a 16 bit μp has a 20 bit address bus can access upto 220 memory locations ( 1 MB). It can support.
Addressing Modes of 8086 Processor Ammar Anwar Khan Electrical Engineer King Saud University Riyadh Saudi Arabia.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
ECE291 Computer Engineering II Lecture 3 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
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.
MOV Instruction MOV destination,source  MOV AX,BX  MOV SUM,EAX  MOV EDX,ARRAY[EBX][ESI]  MOV CL,5  MOV DL,[BX]
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
Data Transfer Instructions Introduction The data transfer instructions are used to move data between internal register or between internal.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Internal Programming Architecture or Model
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
16.317: Microprocessor System Design I
Introduction to 8086 Microprocessor
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
16.317: Microprocessor System Design I
ADDRESSING MODES.
16.317: Microprocessor System Design I
Microprocessor Systems Design I
Chapter 4 Data Movement Instructions
Microprocessor Systems Design I
EE3541 Introduction to Microprocessors
Assembly IA-32.
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Assembly Lang. – Intel 8086 Addressing modes – 1
Morgan Kaufmann Publishers Computer Organization and Assembly Language
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Symbolic Instruction and Addressing
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
32-bit instruction mode(80386-Pentium 4 only)
Symbolic Instruction and Addressing
(Array and Addressing Modes)
CS 301 Fall 2002 Computer Organization
Symbolic Instruction and Addressing
(Array and Addressing Modes)
CNET 315 Microprocessor & Assembly Language
Lecture 06 Programming language.
Computer Architecture CST 250
EECE.3170 Microprocessor Systems Design I
Data Movement Instructions
Chapter 6 –Symbolic Instruction and Addressing
Intel 8086.
(Array and Addressing Modes)
Presentation transcript:

16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 8: Data Transfer Instructions

Lecture outline Announcements/reminders  HW 1 due Friday, 2/10  Lab 1 to be posted; due date TBD Lecture outline  Review: memory addressing modes  Today: data transfer instructions 5/14/2015 Microprocessors I: Lecture 8 2

Review: Addressing modes Addressing modes: how data is specified Memory operands: Address of form SBA:EA Direct: MOV AX, [1010H] EA = 1010H Register indirect: MOV AX, [SI] EA = contents of SI Based: MOV AX, [BX H] EA = (contents of BX) H Indexed: MOV AX, [SI H] EA = (contents of SI) H Based-indexed: MOV AX, [BX + SI H] EA = (contents of BX) + (contents of SI) H 5/14/2015 Microprocessors I: Lecture 8 3

Instruction types 80386DX instruction types Data Transfer instructions Input/output instructions Arithmetic instructions Logic instructions String Instructions Control transfer instructions Processor control 5/14/2015 Microprocessors I: Lecture 8 4

5 Move Instruction Used to move (copy) data between: Registers Register and memory Immediate operand to a register or memory General format: MOV D,S Operation: Copies the content of the source to the destination (S)  (D) Source contents unchanged Flags unaffected Allowed operands Register Memory Accumulator (AH,AL,AX,EAX) Immediate operand (S only) Segment register (Seg-reg) Example: MOV [SUM],AX (AL)  (address SUM) (AH)  (address SUM+1) What is the addressing mode of the destination? 5/14/2015

Microprocessors I: Lecture 8 6 Example of Move Instruction Example MOV DX,CS Source = CS  word data Destination = DX  word data Operation: (CS)  (DX) State before fetch and execution CS:IP = 0100:0100 = 01100H Move instruction code = 8CCAH (01100H) = 8CH (01101H) = CAH (CS) = 0100H (DX) = XXXX  don’t care state 5/14/2015

Microprocessors I: Lecture 8 7 Example (continued) State after execution CS:IP = 0100:0102 = 01102H 01002H  points to next sequential instruction (CS) = 0100H (DX) = 0100H  Value in CS copied into DX - Rest of the bits in EDX unaffected - Value in CS unchanged How are the flags affected? Example of Move Instruction 5/14/2015

Usage of Move Instruction Example—Initialization of internal registers with immediate data and address information What is the final state of all affected registers? Why is AX used to initialize segment registers? 5/14/2015 Microprocessors I: Lecture 8 8

9 Usage of Move Instruction Example—Initialization of internal registers with immediate data and address information DS, ES, and SS registers initialized from immediate data via AX IMM16  (AX) (AX)  (DS) & (ES) = 2000H IMM16  (AX) (AX)  (SS) = 3000H Data registers initialized IMM16  (AX) =0000H (AX)  (BX) =0000H IMM16  (CX) = 000AH and (DX) = 0100H Index register initialized from immediate operands IMM16  (SI) = 0200H and (DI) = 0300H 5/14/2015

Microprocessors I: Lecture 8 10 Sign-Extend and Zero-Extend Move Instruction Sign-Extend Move instruction Used to move (copy) data between two registers or memory and a register and extend the value with the value of the sign bit General format: MOVSX D,S Operation: Copies the content of the source to the destination (S)  (D); source contents unchanged Sign bit  extended through bit 16 or 32 Flags unaffected Examples: MOVSX EBX,AX Where: (AX) = FFFFH S = Reg16 D = Reg32 Sign bit (AX) = 1 FFFFFFFFH  (EBX) Zero-Extend Move instruction—MOVZX Operates the same as MOVSX except extends with zeros Example:MOVZX CX, Byte Pointer [DATA_BYTE] Where: (DATA_BYTE) = FFH,S = Mem8,D = Reg16 00FFH  (CX) Where might one use these instructions? Why both sign extend and zero extend? 5/14/2015

Microprocessors I: Lecture 8 11 Exchange Instruction Used to exchange the data between two data registers or a data register and memory General format: XCHG D,S Operation: Swaps the content of the source and destination Both source and destination change (S)  (D) (D)  (S) Flags unaffected Special accumulator destination version executes faster Examples: XCHG AX,DX (Original value in AX)  (DX) (Original value in DX)  (AX) 5/14/2015

Microprocessors I: Lecture 8 12 Example of Exchange Instruction Example XCHG [SUM],BX Source = BX  word data Destination = memory address SUM  word data Operation: (SUM)  (BX) (BX)  (SUM) State before fetch and execution CS:IP = 1100:0101 = 11101H XCHG instruction code = 871E3412H (01104H,01103H) = 1234H = SUM (DS) = 1200H (BX) = 11AA (DS:SUM) = (1200:1234) = 00FFH 5/14/2015

Microprocessors I: Lecture 8 13 Example (continued) State after execution CS:IP = 1100:0105 = 11105H 11105H  points to next sequential instruction (BX) = 00FFH - Rest of the bits in EBX unaffected - Memory updated (1200:1234) = AAH (1200:1235) = 11H Example of Exchange Instruction 5/14/2015

Microprocessors I: Lecture 8 14 Load Effective Address Load effective address instruction Used to load the effective address of memory operand into a register General format: LEA Reg16/32,EA Operation: EA  (Reg16/32) Source unaffected: Flags unaffected 5/14/2015

Microprocessors I: Lecture 8 15 Load Full Pointer Instructions Used to load a full address pointer from memory into a segment register and register General formats and operation for LDS and LSS LDS Reg16/32,EA (EA)  (Reg16/32) (EA+2/4)  (DS) LSS Reg16/32,EA (EA)  (Reg16/32) (EA+2/4)  (SS) LES, LFS, and LGS operate the same LES Reg16/32,EA (EA)  (Reg16/32),(ES) LFS Reg16/32,EA (EA)  (Reg16/32),(FS) LGS Reg16/32,EA (EA)  (Reg16/32),(GS) 5/14/2015

Microprocessors I: Lecture 8 16 Load Full Pointer Instructions (example) Example LDS SI,[200H] Source = pointer at DS:200H  32 bits Destination = SI  offset of pointer DS  sba of pointer Operation: (DS:200H)  (SI) (DS:202H)  (DS) State before fetch and execution CS:IP = 1100:0100 = 11100H LDS instruction code = C H (11102H,11103H) = (EA) = 2000H (DS) = 1200H (SI) = XXXX  don’t care state (DS:EA) = 12200H = 0020H (DS:EA+2) = 12202H = 1300 Error 02 not 20 5/14/2015

Microprocessors I: Lecture 8 17 Example (continued) State after execution CS:IP = 1100:0104 = 11104H 01004H  points to next sequential instruction (DS) = 1300H  defines new data segment (SI) = 0020H - Rest of the bits in ESI unaffected Load Full Pointer Instructions (example) 5/14/2015

Example DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE AA BBCC DDEE FF Show the results of running the following program if DATA_SEG_ADDR = 1200H: 5/14/2015 Microprocessors I: Lecture 8 18

Example solution DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE AA BBCC DDEE FF MOV AX,DATA_SEG_ADDR AX = DATA_SEG_ADDR = 1200H MOV DS, AX DS = AX = 1200H MOV SI, [INIT_TABLE] SI = DS:INIT_TABLE = 2211H LES DI,[INIT_TABLE+02H] DI = DS:INIT_TABLE+02H = 4433H ES = DS:INIT_TABLE+04H = 6655H 5/14/2015 Microprocessors I: Lecture 8 19

Example solution (cont.) DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE AA BBCC DDEE FF MOV AX,[INIT_TABLE+06H] AX = DS:INIT_TABLE+06H = 8877H MOV SS, AX SS = AX = 8877H MOV AX,[INIT_TABLE+08H] AX = DS:INIT_TABLE+08H = AA99H MOV BX,[INIT_TABLE+0AH] BX = DS:INIT_TABLE+0AH = CCBBH 5/14/2015 Microprocessors I: Lecture 8 20

Example solution (cont.) DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE AA BBCC DDEE FF MOV CX,[INIT_TABLE+0CH] CX = DS:INIT_TABLE+0CH = EEDDH MOV DX,[INIT_TABLE+0EH] DX = DS:INIT_TABLE+0EH = 16FFH 5/14/2015 Microprocessors I: Lecture 8 21

Next time Arithmetic instructions 5/14/2015 Microprocessors I: Lecture 8 22