© 2006 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by.

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

Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Judul Mata Kuliah Judul Pokok Bahasan 1/total Data Movement Instructions.
EZ-COURSEWARE State-of-the-Art Teaching Tools From AMS Teaching Tomorrow’s Technology Today.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 1 Chapter Four.
Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 3 Addressing Modes Barry B. Brey.
Data Movement Instructions
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
8-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 5 Arithmetic and Logic Instructions.
Microcomputer & Interfacing Lecture 3
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Topic – string – Ch. 11 [Marut] Ch. 4 [Brey] String Data Transfer Instructions – The Direction Flag – LODS Instructions – STOS Instructions – MOVS Instructions.
Chapter 3: Addressing Modes. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors:
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
An Introduction to 8086 Microprocessor.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
Addressing Modes of 8086 Processor Ammar Anwar Khan Electrical Engineer King Saud University Riyadh Saudi Arabia.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 4.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
Khaled A. Al-Utaibi  I/O Ports  I/O Space VS Memory Space  80x86 I/O Instructions − Direct I/O Instructions − Indirect I/O Instructions.
ECE291 Computer Engineering II Lecture 3 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
Addressing Modes. Addressing Mode The data is referred as operand. The operands may be contained in registers, memory or I/O ports, within the instruction.
MOV Instruction MOV destination,source  MOV AX,BX  MOV SUM,EAX  MOV EDX,ARRAY[EBX][ESI]  MOV CL,5  MOV DL,[BX]
CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
Internal Programming Architecture or Model
Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Micro-Computer Applications: Arithmetic, Logic & Data Movement Instructions Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
BITS Pilani Pilani Campus Pawan Sharma Lecture /12/ EEE /INSTR/CS F241 ES C263 Microprocessor Programming and Interfacing.
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.
Chapter 8 String Operations. 8.1 Using String Instructions.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Data Movement Instructions A Course in Microprocessor Electrical Engineering Department Universitas 17 Agustus 1945 Jakarta.
Stack Operations Dr. Hadi AL Saadi.
Instruction set Architecture
Microprocessor and Assembly Language
UNIT–II 8086 Family Assembly Language Programming
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
Microprocessor and Assembly Language
Chapter 4 Data Movement Instructions
EE3541 Introduction to Microprocessors
Machine control instruction
INSTRUCTION SET.
ADDRESSING MODES.
Chapter 3 Addressing Modes
CS-401 Assembly Language Programming
Subject Name: MICROPROCESSORS Subject Code:10CS45
Subject Name: Microprocesor Subject Code: 10CS45
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
Chapter 4 Data Movement Instructions
8086 Registers Module M14.2 Sections 9.2, 10.1.
32-bit instruction mode(80386-Pentium 4 only)
Practical Session 4.
T opic: S TRING I NSTRUCTION P RESENTED B Y: N OOR FATIMA M AHA AKRAM ASIF.
University of Gujrat Department of Computer Science
Data Movement Instructions
CNET 315 Microprocessor & Assembly Language
Presentation transcript:

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by Barry B. Brey

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e MOV et.al. MOV is still the main data transfer instruction, but there are many variations that perform special tasks such as PUSH and POP. MOV is still the main data transfer instruction, but there are many variations that perform special tasks such as PUSH and POP. We do not often code in hexadecimal machine language, but an understanding tends to help with learning the instruction set and the form of instructions in the memory. We do not often code in hexadecimal machine language, but an understanding tends to help with learning the instruction set and the form of instructions in the memory.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Instruction Modes Instructions operate in the 16- or 32-bit mode. 16-bit mode instructions are used in DOS and 32-bit mode instructions are used in Windows. Instructions operate in the 16- or 32-bit mode. 16-bit mode instructions are used in DOS and 32-bit mode instructions are used in Windows. A prefix is used to switch between modes for one instruction at a time. A prefix is used to switch between modes for one instruction at a time. The register override prefix is 66H and is a byte that precedes the opcode in the memory, The register override prefix is 66H and is a byte that precedes the opcode in the memory, The address override prefix is a 67H and like 66H precedes the opcode in the memory. The address override prefix is a 67H and like 66H precedes the opcode in the memory.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e The register size prefix switches from 8- and 16-bit registers in the 16-bit mode to 8- and 32-bit registers. The register size prefix switches from 8- and 16-bit registers in the 16-bit mode to 8- and 32-bit registers. The register size prefix switches from 8- and 32-bit registers to 8- and 16-bit registers in the 32-bit mode. The register size prefix switches from 8- and 32-bit registers to 8- and 16-bit registers in the 32-bit mode. (DOS)MOV EAX,EBX ;reg prefix used (Windows) MOV AX,BX ;reg prefix used

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e The Opcode

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Fields of an Instruction The D bit in the first byte of an instruction is the direction of data flow either from or to R/M from REG. If D = 0 REG  R/M and if D = 1 R/M  REG The D bit in the first byte of an instruction is the direction of data flow either from or to R/M from REG. If D = 0 REG  R/M and if D = 1 R/M  REG The W bit in the first byte of the opcode either specifies a word (16-bit mode) or a doubleword (32-bit mode). W = 0 byte and W = 1 word/doubleword The W bit in the first byte of the opcode either specifies a word (16-bit mode) or a doubleword (32-bit mode). W = 0 byte and W = 1 word/doubleword

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e The MOD field in the second byte specifies how R/M is used and wether a displacement exists. The MOD field in the second byte specifies how R/M is used and wether a displacement exists. R/M R/M MOD = 00 memory no displacement MOD = 00 memory no displacement MOD = 01 memory 8-bit displacement MOD = 01 memory 8-bit displacement MOD = 10 memory 16/32-bit displacement MOD = 10 memory 16/32-bit displacement MOD = 11 register MOD = 11 register

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e The REG contains the register The REG contains the register The R/M field contains a register or a memory addressing mode as in [BX], etc. The R/M field contains a register or a memory addressing mode as in [BX], etc. Luckily we do not often need to code into hexadecimal form, that is why we have an assembler. The reason this is explained in the text is so that a feeling for the way instructions are coded is understood and why different instruction contain different numbers of bytes. This knowledge may help when generating efficient code. Luckily we do not often need to code into hexadecimal form, that is why we have an assembler. The reason this is explained in the text is so that a feeling for the way instructions are coded is understood and why different instruction contain different numbers of bytes. This knowledge may help when generating efficient code.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Segment Register Moves Although we do not often directly address segment registers it is important to understand the limitations of the segment register MOV instruction. Although we do not often directly address segment registers it is important to understand the limitations of the segment register MOV instruction. Immediate data cannot be moved into a segment register. Immediate data cannot be moved into a segment register. CS cannot successfully be loaded with a segment register MOV. CS cannot successfully be loaded with a segment register MOV.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e PUSH and POP PUSH and POP transfer data to and from the stack. The stack is an area of memory that is reused and grows in size with each PUSH and shrinks in size with each POP. PUSH and POP transfer data to and from the stack. The stack is an area of memory that is reused and grows in size with each PUSH and shrinks in size with each POP. PUSH and POP function with either 16- or 32-bit data. PUSH and POP function with either 16- or 32-bit data. PUSHF (PUSHFD) and POPF (POPFD) save and restore the flags (EFLAGS) PUSHF (PUSHFD) and POPF (POPFD) save and restore the flags (EFLAGS) PUSHA (PUSHAD) and POPA (POPAD) save and restore all the registers PUSHA (PUSHAD) and POPA (POPAD) save and restore all the registers

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Load Segment and Index LDS, LES, LSS, LFG, and LGS allow a segment registers and a pointer to both be loaded from memory. LDS, LES, LSS, LFG, and LGS allow a segment registers and a pointer to both be loaded from memory. LDS BX,BOB ;loads DS and BX with the offset and segment address stored in a 32-bit memory location called BOB.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e LEA The LEA instruction loads the effective address of a memory location into a pointer or index register. The LEA instruction loads the effective address of a memory location into a pointer or index register. At times we do the same operation with a MOV and the keyword OFFSET At times we do the same operation with a MOV and the keyword OFFSET MOV BX,OFFSET FRED LEA BX,FRED Both instruction accomplish the same task.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e String Data Transfer Instructions String data transfer instructions are: LODS, STOS, MOVS, INS, and OUTS. String data transfer instructions are: LODS, STOS, MOVS, INS, and OUTS. These instructions use the direction flag bit to select the way that a pointer is modified after the instruction. D = 0 auto-increment and D = 1 auto-decrement. These instructions use the direction flag bit to select the way that a pointer is modified after the instruction. D = 0 auto-increment and D = 1 auto-decrement. Many of these instructions can be prefixed with a REP (repeat) to repeat the instruction the number of times stored in the CX register. Many of these instructions can be prefixed with a REP (repeat) to repeat the instruction the number of times stored in the CX register.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Miscellaneous NOP (does nothing) NOP (does nothing) XCHG (swaps contents) XCHG (swaps contents) XLAT (table lookup) XLAT (table lookup) CLC, STC, CMC (modify Carry) CLC, STC, CMC (modify Carry) STD and CLD (modify direction) STD and CLD (modify direction) STI and CLI (modify interrupt) STI and CLI (modify interrupt)

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e IN and OUT The two I/O instructions transfer data between an I/O device and the accumulator (AL, AX, and EAX). The two I/O instructions transfer data between an I/O device and the accumulator (AL, AX, and EAX). 16-bit I/O address means there are up to 64K I/O devices possible in a system. 16-bit I/O address means there are up to 64K I/O devices possible in a system.