© 2006 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 3 Addressing Modes Barry B. Brey.

Slides:



Advertisements
Similar presentations
COMP 2003: Assembly Language and Digital Logic
Advertisements

1/2002JNM1 AL 00 Immediate Addressing Mode Mov AL, 3CH AL 3C.
Irvine, Kip R. Assembly Language For Intel-Based Computers TYPE and SIZE Operators TYPE –returns the size, in bytes of a single element of a data label.
Data Movement Instructions
Lecture 6 Machine Code: How the CPU is programmed.
The 8086 Assembly Programming Data Allocation & Addressing Modes
KMUTT: S. Srakaew Instructions Can Be Divided into 3 Classes Data movement instructions  Move data from a memory location or register to another memory.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 13 Direct Memory Access and DMA-
Target Processor Directives , When using.386, the program can only run on 386 and above processors.
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.
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
© 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.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 4 Data Movement Instructions by.
Microprocessor Systems Design I
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Chapter 3: Addressing Modes. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors:
Assembly Language – Lab 5
CSC 221 Computer Organization and Assembly Language
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
Faculty of Engineering, Electrical Department,
The x86 PC Assembly Language, Design, and Interfacing By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey © 2010, 2003, 2000, 1998 Pearson.
Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Strings, Procedures and Macros
26-Nov-15 (1) CSC Computer Organization Lecture 6: Pentium IA-32.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Introduction to Assembly II Abed Asi Extended System Programming Laboratory (ESPL) CS BGU Fall 2013/2014.
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]
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
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.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
Assembly Language for Intel-Based Computers, 4 th Edition Lecture 22: Conditional Loops (c) Pearson Education, All rights reserved. You may modify.
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.
Type of addressing mode
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.
Instruction set Architecture
Format of Assembly language
Segment Definition The CPU has several segment registers:
Instruksi Set Prosesor 8088
16.317: Microprocessor System Design I
Microprocessor and Assembly Language
Microprocessor Systems Design I
Microprocessor and Assembly Language
Chapter 4 Data Movement Instructions
Assembly IA-32.
Assembly Language Programming Part 2
Microprocessor and Assembly Language
Chapter 3 Addressing Modes
CS 301 Fall 2002 Control Structures
Subject Name: Microprocesor Subject Code: 10CS45
Computer Organization and Assembly Language
Chapter 4: Instructions
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 Registers Module M14.2 Sections 9.2, 10.1.
Chapter 3: Addressing Modes
CNET 315 Microprocessor & Assembly Language
3.6 Data transfer Instructions
Addressing Modes MOV AX,BX Destination Source Data-Addressing Modes.
EECE.3170 Microprocessor Systems Design I
X86 Assembly Review.
CS-401 Computer Architecture and Assembly Language Programming
The JUMP GROUP Unconditional Jump (JMP).
(The Stack and Procedures)
Presentation transcript:

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 3 Addressing Modes Barry B. Brey

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Addressing Modes In order to write a program addressing modes must be thoroughly understood. In order to write a program addressing modes must be thoroughly understood. There are many addressing modes, but the most common are easy to master and represent most instructions in most programs. There are many addressing modes, but the most common are easy to master and represent most instructions in most programs. Register addressing, immediate addressing, direct addressing, and simple forms of indirect addressing are the most common addressing modes. Register addressing, immediate addressing, direct addressing, and simple forms of indirect addressing are the most common addressing modes.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Stack addressing is also used with the PUSH and POP instructions and as a way to link a program to its procedures or functions. Stack addressing is also used with the PUSH and POP instructions and as a way to link a program to its procedures or functions. Program flow instructions are either unconditional or conditional. Program flow instructions are either unconditional or conditional. Conditional program flow instructions are the “if” statements of assembly language. Conditional program flow instructions are the “if” statements of assembly language.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Data Addressing Modes Data addressing modes are presents with the MOV instruction because it is by far the most common instruction in a program. Data addressing modes are presents with the MOV instruction because it is by far the most common instruction in a program. MOV really moves nothing. MOV copies the source into the destination. It probably should be named COP for copy, but it is not. MOV really moves nothing. MOV copies the source into the destination. It probably should be named COP for copy, but it is not.

© 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

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Register MOV EAX,EBX MOV EAX,EBX MOV CX,DX MOV CX,DX MOV AH,AL MOV AH,AL MOV AX,DS MOV AX,DS MOV ES,CX MOV ES,CX ADD AL,CL (most instructions use it) ADD AL,CL (most instructions use it) OR AX,DX OR AX,DX

© 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 Immediate MOV EAX,234H MOV EAX,234H MOV CX,2 MOV CX,2 MOV AL,34H MOV AL,34H ADD AL,3 ADD AL,3 SUB CL,4 SUB CL,4 AND EAX,1 AND EAX,1

© 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 Direct MOV BOB,EAX MOV BOB,EAX MOV FRED,CX MOV FRED,CX MOV BILLY,AL MOV BILLY,AL MOV EDI,RALPH MOV EDI,RALPH MOV AX,STEVE MOV AX,STEVE MOV DS,BARNEY MOV DS,BARNEY MOV AL,DS:[1000H] MOV AL,DS:[1000H]

© 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 Register Indirect MOV AL,[BX] MOV AL,[BX] MOV AX[EBX] MOV AX[EBX] MOV [EDI],EAX MOV [EDI],EAX MOV [EAX],EDX MOV [EAX],EDX MOV BYTE PTR [EAX],6 MOV BYTE PTR [EAX],6 MOV WORD PTR [ECX],12 MOV WORD PTR [ECX],12 MOV DWORD PTR [ESI],2345H MOV DWORD PTR [ESI],2345H

© 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 Base Plus Index MOV AL,[BX+SI] MOV AL,[BX+SI] MOV [BX+DI],AX MOV [BX+DI],AX MOV [BP+SI],EAX MOV [BP+SI],EAX MOV AL,[BP+DI] MOV AL,[BP+DI] MOV WORD PTR [BX+SI],5 MOV WORD PTR [BX+SI],5 ADD AL,[BX+DI] ADD AL,[BX+DI]

© 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 Register Relative MOV AL,[BX+3] MOV AL,[BX+3] MOV AX,[DI+20H] MOV AX,[DI+20H] MOV [EDI+200H],EAX MOV [EDI+200H],EAX MOV [BX-33],ECX MOV [BX-33],ECX ADD BYTE PTR [BX+2],5 ADD BYTE PTR [BX+2],5

© 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 Relative Plus Index MOV AL,[BX+SI+22] MOV AL,[BX+SI+22] MOV [BX+DI-22],AX MOV [BX+DI-22],AX MOV EAX,[EBX+EDI+100H] MOV EAX,[EBX+EDI+100H]

© 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 Scaled Index MOV EAX,[EBX+ 4*ECX] MOV EAX,[EBX+ 4*ECX] MOV AX,[EDI+2*EBX] MOV AX,[EDI+2*EBX] MOV [EAX+2*EBX],DX MOV [EAX+2*EBX],DX MOV [4*ECX],EBX MOV [4*ECX],EBX ADD AL,[ECX+EBX] ADD AL,[ECX+EBX]

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Program Flow Program flow instruction are unconditional (JMP) or conditional (JNZ). Program flow instruction are unconditional (JMP) or conditional (JNZ). Flow instructions are short (+127, -128), near (±32K), or far (anywhere in the memory). Flow instructions are short (+127, -128), near (±32K), or far (anywhere in the memory). Conditionals do not contain the far type. Conditionals do not contain the far type. Labels are followed by a colon if they are jumped to in a program. Labels are followed by a colon if they are jumped to in a program.

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Stack Addressing The SS (stack segment) and the SP/ESP are added to form an address in the stack. The SS (stack segment) and the SP/ESP are added to form an address in the stack. The stack is an area of memory that functions as a last-in, first-out (LIFO) memory. That is if a 1 followed by a 2 are placed on the stack the 2 comes out of the stack first, followed by the 1. The stack is an area of memory that functions as a last-in, first-out (LIFO) memory. That is if a 1 followed by a 2 are placed on the stack the 2 comes out of the stack first, followed by the 1. PUSH and POP are used to store data on the stack and to remove data from the stack as words or doubleword, PUSH and POP are used to store data on the stack and to remove data from the stack as words or doubleword,

© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e PUSH AX PUSH AX PUSH EAX PUSH EAX POP AX POP AX POP EAX POP EAX PUSH BOB PUSH BOB POP BOB POP BOB PUSHF PUSHF POPF POPF

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