Addressing Modes MTT48 3 - 16 CPU08 Core Motorola CPU08 ADDRESSING MODES.

Slides:



Advertisements
Similar presentations
CPU Structure and Function
Advertisements

There are two types of addressing schemes:
Computer Organization and Architecture
Processor Function Topic 3.
5/6/99 Ashish Sabharwal1 JVM Architecture n Local storage area –Randomly accessible –Just like standard RAM –Stores variables (eg. an array) –Have to specify.
Pentium Addressing Modes
Unit -II CPU Organization By- Mr. S. S. Hire. CPU organization.
EET 2261 Unit 2 HCS12 Architecture
Computer Architecture
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
Processor Organization and Architecture Module III.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Module 10 Adapted By and Prepared James Tan © 2001.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
Addressing Modes Chapter 6 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
Computer Organization
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Topics covered: Instruction Set Architecture CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Ch.2 Intro. To Assembly Language Programming From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
1 Microcontroller Fundamentals & Programming Addressing Modes.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
Addressing Modes and Formats
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides additional details about the.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.
Microprocessors I 8051 Addressing Modes CS Prof. Msc. Ivan A. Escobar
Computer Architecture & Operations I
Displacement (Indexed) Stack
Overview of Instruction Set Architectures
Addressing Modes in Microprocessors
Part of the Assembler Language Programmers Toolbox
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
Microprocessor and Assembly Language
Alvaro Mauricio Peña Dariusz Niworowski Frank Rodriguez
8051 Addressing Modes The way, using which the data source or destination addresses are specified in the instruction mnemonic for moving the data, is.
Microcomputer Programming
William Stallings Computer Organization and Architecture 8th Edition
Computer Organization and Assembly Language (COAL)
Processor Organization and Architecture
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
Chapter 8 Central Processing Unit
Processor Organization and Architecture
ECEG-3202 Computer Architecture and Organization
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
68000 Architecture, Data Types and Addressing Modes
Chapter 4 Instruction Set.
Introduction to Micro Controllers & Embedded System Design
Computer Architecture
Computer Instructions
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
8051 ASSEMBLY LANGUAGE PROGRAMMING
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Architecture and System Programming Laboratory
Presentation transcript:

Addressing Modes MTT CPU08 Core Motorola CPU08 ADDRESSING MODES

Addressing Modes MTT CPU08 Core Motorola Inherent Immediate Direct Extended Indexed Relative Memory to Memory ADDRESSING MODES

Addressing Modes MTT CPU08 Core Motorola Inherent Addressing Has no operand Operates mostly on CPU registers or bits Example: CLRA * opcode location Memory program space data space ocl* ocl F X A CPU 0 X

Addressing Modes MTT CPU08 Core Motorola Immediate Addressing Specifies value directly, not an address of the value Indicated by # Has one operand Contained in the byte or bytes immediately following opcode Example: LDA#$FF Memory program space data space ocl ocl + 1 A 6 F X A CPU F X

Addressing Modes MTT CPU08 Core Motorola Direct Addressing Specifies 8 bit address of operand Upper byte of 16 bit address is assumed to be $00 Used to access first 256 bytes of memory Address contained in the byte immediately following opcode Example: LDA$50 Memory program space data space ocl ocl + 1 B X A A CPU A X

Addressing Modes MTT CPU08 Core Motorola Extended Addressing Specifies 16 bit address of operand Used to access address greater $00FF memory Address contained in the two bytes immediately following opcode Example: LDA$0400 Memory program space data space ocl ocl + 1 C X A ocl + 20 A CPU X A

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - NO Offset - Specifies H:X index register contains the address of the operand Example: CLR,X CPU H:X 0400 Memory program space ocl ocl F X data space X 0400 ocl + 2X

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - 8 Bit Offset- Unsigned 8 bit offset + unsigned H:X register = memory location H:X register is unaffected 8 bit offset is the byte immediately following opcode Example: CLR10,X CPU H:X 0400 Memory program space ocl ocl F 0 A data space X 040A ocl + 2X 0 040A

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - 16 Bit Offset - Unsigned 16 bit offset + unsigned H:X register = memory location H:X register is unaffected 16 bit offset is the two bytes immediately following opcode Example: STA$0100,X Memory program space ocl ocl + 1 D data space X 0150 ocl CPU H:X A

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - 8 & 16 Bit Offsets - Commonly used to access elements of data structures Offset would be base address of structure Index register would contain displacement to the Nth element ORG$100 TableFCB$10, $20, $30, $ * Calculate displacement for element N in A CLRH TAX LDATable,X NOTE: If Table were in the first 256 bytes of memory, most assemblers would use an 8-bit offset instruction element Table H:X=N element 1 element 2 element 3 element n element n+1 element n+2 element n+3

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - Using Stack pointer and 8-Bit Offset - Unsigned 8 bit offset + unsigned SP register = memory location SP register is unaffected 8 bit offset is the byte immediately following opcode bytes Example: STA5,SP Memory program space ocl ocl E E 7 stack space X 00D0 ocl F 00D5 CPU SP 00D0 FF A

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - Using Stack pointer and 16-Bit Offset - Unsigned 16 bit offset + unsigned SP register = memory location SP register is unaffected 16 bit offset is the two bytes immediately following opcode bytes Example: STA$100,SP CPU SP 00D0 FF A Memory program space ocl ocl E D 7 data space X 00D0 ocl F 01D0 0 ocl + 3 NOTE: If interrupts are disabled, SP can be used as an additional index register Less efficient because of pre byte

Addressing Modes MTT CPU08 Core Motorola Stack Pointer - 8 Bit Offsets - High level language support Compilers often place parameters for procedures and temporary storage on the stack Stack Pointer addressing is an efficient means to access this information 00C0 SPX temp 1 temp 2 msb temp 2 lsb param 3 param 2 param 1 temp 1 = 1,SP temp 2 = 2,SP and 3,SP param 3 = 4,SP param 2 = 5,SP param 1 = 6,SP What happens if the stack pointer moves? ie: more information is pushed onto the stack. Where is -1,SP ?

Addressing Modes MTT CPU08 Core Motorola Relative Addressing

Addressing Modes MTT CPU08 Core Motorola Relative Addressing Cont. Used in all conditional branch instructions If condition is TRUE Program Counter = Program Counter + Signed 8 bit offset else Program Counter is unaffected Example: BEQ$8100 CPU PC 8152 Memory program space $8150 $ A E $8152X 8100 if condition true

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - No Offset with Post Increment - Specifies H:X index register contains the address of the operand After address of operand is calculated, H:X is incremented by 1 Example: LoopCBEQX+,Out BRALoop Out.... Memory program space ocl ocl data space X 0400 ocl + 2X CPU H:X A

Addressing Modes MTT CPU08 Core Motorola Indexed Addressing - 8 bit Offset with Post Increment - Just like indexed addressing with 8 bit offset, plus post increment After address of operand is calculated, H:X is incremented by 1 Example: LoopCBEQ$50,X+,Out BRALoop Out.... ocl + 1 ocl + 2 Memory program space ocl data space X CPU H:X A

Addressing Modes MTT CPU08 Core Motorola Memory to Memory Addressing Used to move information from one location to another Does not use/affect CPU registers –Except when using indexed addressing with post increment More efficient than Load/Store combination Can only be used with the MOV instruction MOVSource Address,Destination Address Four variations: Immediate to Direct Direct to Direct Indexed to Direct with Post Increment Direct to Indexed with Post Increment

Addressing Modes MTT CPU08 Core Motorola Source is one byte immediate value Destination must be in first 256 bytes of memory Example usage: Initialization of variables or registers Memory to Memory Addressing - Immediate to Direct - MOV#$AA,$F0 Memory program space ocl ocl E A ocl + 2F 0 data space X 00F0 A 00F0

Addressing Modes MTT CPU08 Core Motorola Source must be in first 256 bytes of memory Destination must be in first 256 bytes of memory Example usage: Moving data from one page zero location to another Memory to Memory Addressing - Direct to Direct - MOV$00,$F0 Memory program space ocl ocl E 0 ocl + 2F 0 data space X 00F0 5 00F0 data space

Addressing Modes MTT CPU08 Core Motorola Memory to Memory Addressing - Indexed with Post Increment to Direct - MOVX+,$18 Memory program space ocl ocl E 1 8 ocl + 2X data space Source may be any where in memory map Destination must be in first 256 byte of memory Example usage: Writing data to a communications device from a buffer CPU H:X X data space

Addressing Modes MTT CPU08 Core Motorola Memory to Memory Addressing - Direct to Indexed with Post Increment - MOV$18,X+ Memory program space ocl ocl E 1 8 ocl + 2X data space Source must be in first 256 byte of memory Destination may be any where in memory map Example usage: Writing data from a communications device to a buffer CPU H:X X data space

Addressing Modes MTT CPU08 Core Motorola MEMORY TO MEMORY - EXAMPLE - SCI communication handling routines ORG$50 RCVPTRRMB2 XMTPTRRMB2 ORG$100 RCVBRMB10 XMTBRMB10 Receive LDHXRCVPTR MOV$18,X+ STHXRCVPTR Transmit LDHXXMTPTR MOVX+,$18 STHXXMTPTR RCVPTR 0100 XMTPTR 010A

Addressing Modes MTT CPU08 Core Motorola Addressing Modes Summary MODEExample Usage InherentPULX ImmediateADD#$10 DirectSUB$50 ExtendedSUB$200 Indexed no offsetSTA,X 8 or 16 bit offsetLDX$200,X post incrementCBEQX+,There 8 bit offset w/ post incCBEQ$50,X+,There Stack Pointer 8 or 16 bit offsetCLR5,SP Relative (PC)BEQHere Memory to Memory Immediate to DirectMOV#$00,$A0 Direct to DirectMOV$18,$F0 Indexed post inc to DirectMOVX+,$12 Direct to Indexed post incMOV$12,X+

Addressing Modes MTT CPU08 Core Motorola Address Modes Exercises For each operation, complete the instruction using the appropriate addressing mode. Also indicate the length (# of bytes) of the instruction and execution time (# of cycles). 1. Load accumulator A with the hex value Load the X register with the contents of memory location hex C1. 3. Load the X register with the contents of the memory location whose address is the contents of the X register. 4. Load accumulator A with the contents of the memory location whose address is the contents of X register higher than the memory address $220. HC08-addrSol Instruction: Operand: Bytes: Cycles: LDA LDX LDA 5. Normal branch instructions can change the program counter to an address as far as bytes forward or bytes backward in program memory relative to the address of the branch opcode. 6. Indexed addressing generates a memory address that is the sum of two values: a register and an offset. The register value is a (constant/variable) and the offset value is a (constant/variable). 7. Direct and Extended address modes generate a (constant/variable) address. Direct requires a (one/two) byte address in program memory whose value is from to ; Extended requires a (one/two) byte address in program memory whose value is from to. 8. A common way to use the 16-bit offset with index address mode is to use the (offset, X register) as the starting address to a table of items and the (offset, X register) as the distance to select the item to be accessed.