Introduction to Microcomputer Systems Addressing modes

Similar documents
N bit is set if result of operation in negative (MSB = 1) Z bit is set if result of operation is zero (All bits = 0)

S12CPUV2. Reference Manual HCS12. Microcontrollers. S12CPUV2/D Rev. 0 7/2003 MOTOROLA.COM/SEMICONDUCTORS

A Simple MC9S12 Program

CPU12 REFERENCE MANUAL

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access

Exam I Review February 2017

MIGRATING TO THE 68HC12 IN C

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Lecture #3 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Wednesday, 20-Jan-2015

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

Addressing Mode Description Addressing Mode Source Format Abbrev. Description

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Cmpt 150 The Freescale CPU12 March, The Freescale HC12

EE 308 Spring The HCS12 has 6 addressing modes

Introduction to Programming

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

Computer Organization

What is an Addressing Mode?

Instruction set of 8085

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

ECE 4510/5530 Microcontroller Applications Chapter 1

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

2. ADDRESSING METHODS

Assembly Language Programming of 8085

ADDRESS GENERATION UNIT (AGU)

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

OSIAC Read OSIAC 5362 posted on the course website

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

Microcontrollers. Microcontroller

Accumulator and memory instructions 1. Loads, stores, and transfers 2. Arithmetic operations 3. Multiply and divide 4. Logical operations 5. Data test

Chapter 7 Central Processor Unit (S08CPUV2)

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture

Code segment Stack segment

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

MOXSYN. General Description. Features. Symbol

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes.

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

8085 INSTRUCTION SET INSTRUCTION DETAILS

538 Lecture Notes Week 2

CS/ECE 5780/6780: Embedded System Design

SECTION 5 ADDRESS GENERATION UNIT AND ADDRESSING MODES

CHAPTER 8: Central Processing Unit (CPU)

instruction 1 Fri Oct 13 13:05:

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

SECTION 6 CENTRAL PROCESSING UNIT


Computer Architecture

8051 Overview and Instruction Set

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Lecture 04: Machine Instructions

Understand the factors involved in instruction set

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

EE 3170 Microcontroller Applications

William Stallings Computer Organization and Architecture

Programming the Motorola MC68HC11 Microcontroller

Assembly Language Programming of 8085

Processor Design. ELEC 418 Advanced Digital Systems Dr. Ron Hayne

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

3. (3) Convert the following CUSP instruction into the appropriate bit pattern: ADS+! $103

Chapter 3 Structured Program Development in C Part II

Lecture 6 Assembly Programming: Branch & Iteration

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

TYPES OF INTERRUPTS: -

CSCE 5610: Computer Architecture

INSTRUCTION SET OF 8085

Introduction to Embedded Systems. Some Nagging

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Microcontroller Intel [Instruction Set]

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

AVR ISA & AVR Programming (I)

Computer System Architecture

68HC11 PROGRAMMER'S MODEL

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

Mark II Aiken Relay Calculator

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

CS401 - Computer Architecture and Assembly Language Programming Glossary By

CPU Structure and Function

The 6502 Instruction Set

Due Monday, February 21. EECC550 - Shaaban. MicroTiger executable: microtiger-student.exe Required program support DLLs:

CS3350B Computer Architecture Quiz 3 March 15, 2018

Programming of 8085 microprocessor and 8051 micro controller Study material

Lecture 4: Instruction Set Architecture

Addressing Modes. To review data transfer instructions and applying the more advanced addressing modes.

Instruction Set Principles and Examples. Appendix B

The Motorola 68HC11 Instruc5on Set

Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack

SECTION 5 PROGRAM CONTROL UNIT

Intel 8086 MICROPROCESSOR ARCHITECTURE

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Chapter 9. Programming Framework

A. CPU INSTRUCTION SET SUMMARY

Transcription:

Dept. of Computer Science and Engineering Introduction to Microcomputer Systems Overview Addressing mode Source form Abbreviation Description Inherent INST (no externally supplied operands) INH Immediate INST #opr8i or INST #opr16i IMM 2005-08-31 Operands (if any) are in CPU registers Operand is included in instruction steam; 8-bit or 16- bit size implemented by context Direct INST opr8a DIR Operand in the lower 8-bits of an adress in tghe range $0000 - $00FF Extended INST opr16a EXT Operand is a 16-bit address Relative (5-bit offset) (predecrement) (preincrement) INST rel8 or INST rel16 REL Effective address is the value in PC plus an 8-bit or 16-bit relative offset value INST oprx5,xysp IDX Effective adress is the value in X, Y, SP or PC plus a 5- bit signed constant value INST oprx3,-xys IDX Effective adress is the value in X, Y or SP autodecremented by 1 to 8 INST oprx3,+xys IDX Effective adress is the value in X, Y or SP autoincremented by 1 to 8 CHALMERS UNIVERSITY OF TECHNOLOGY Campus Lindholmen Sida 1 Dept. Of Computer Science and Engineering Visiting address: Hörselgången 11, house Jupiter 4:th floor P.O.Box 8873 SE-402 72 Göteborg

Addressing mode Source form Abbreviation Description (postdecrement) INST oprx3,xys- IDX Effective adress is the value in X, Y or SP. The value is postdecremented by 1 to 8 (postincrement) (accumulator offset) (9-bit offset) (16-bit offset) - indirect (16-bit offset) - indirect (D accumulator offset) INST oprx3,xys+ IDX Effective adress is the value in X, Y or SP. The value is postincremented by 1 to 8 INST abd,xysp IDX Effective adress is the value in X, Y, SP or PC plus thye value in A, B or D INST oprx9,xysp IDX1 Effective adress is the value in X, Y, SP or PC plus a 9- bit signed constant value INST opr16,xysp IDX2 Effective adress is the value in X, Y, SP or PC plus a 16- bit constant value INST [oprx16,xysp] [IDX2] The value in X, Y, SP or PC plus a 16-bit constant offset points to the effective address INST [D,sysp] [D,IDX] The value in X, Y, SP or PC plus the value in D points to the effective address Inherent addressing mode The instructions have no operand or all operands are in the internal registers. The CPU does not need to access any memory locations NOP INX; ;this instruction has no operand ;operand is in CPU register Immediate addressing mode The operands are included in the instruction stream. The pound symbol (#) is used to indicate an immediate addressing mode LDAA #$55 LDX #2034 Direct addressing mode The addressing mode is sometimes called zero-page addressing because it uses a 8-bit address to access addresses in the range $0000 to $00FF LDAA $55 ;load accumulator A from address $0055 page 2

STX $AC ;store the value in index register X in address $AC and $AD (since the value in index register X is 16 bits Extended addressing mode In this addressing mode the full 16-bit address of the memory location is used LDAA $1055 ;load accumulator A from address $1055 STX $25AC ;store the value in index register X in address $25AC and $25AD (since the value in index register X is 16 bits Relative addressing mode This mode is used only by branch instructions. Short and long conditional branch instructions use relative addressing mode exclusively, but branching versions of bit manipulation instructions use multiple addressing modes, including relative mode. Short branch instruction contain a signed 8-bit offset (branch step). Long branch instructions contain a signed 16-bit offset (long branch step) BEQ label ;branch to the program line marked by label if zero flag is set, continue with the next instruction otherwise addressing modes There are a number of indexed addressing modes that can be split into the following groups. addressing modes with fixed offset The effective address is the value in the X, Y, SP or PC register plus a 5-, 9- or 16-bit signed constant value contained in the instruction. The instruction does not change the value in the index register. The only difference between the variants is the total size of the opcode for the instruction. The 5-bit version give a range of -16 to +15 from the value in the base index register. The 9-bit version give a range of -256 to +255 from the value in the base index register. The 16-bit version give access to any address in the 64-Kbyte address space. Since the address bus and the offset are both 16 bits it does not matter if the offset value is considered to be signed or unsigned LDAA 0,X STAB -3,Y LDX $20,X ;load accumulator A from the address contained in X ;store accumulator B in the address contained in X minus 3 addresses ;load index register X from the address contained in index register X plus 64 ($20) addresses and from the next consecutive address ((X)+$20):(X)+$20+1) page 3

16-bit constant indirect indexed addressing The addressing mode adds a 16-bit instruction-supplied offset to the address in the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. The instruction itself does not point to the address of the memory location to be acted on, but rather to the location of a pointer to the address to be acted on. The square brackets distinguish this addressing mode from 16-bit constant offset indexing LDAA [10,X] ;the instruction first adds the value 10 to the value in X and then a pointer to the memory location to be acted on is fetched memory location pointed at by this sum addressing modes pre-/post decrement/increment In this addressing mode the index register can be automatically decremented or incremented before or after the indexing takes place. The pre-decrement and pre-increment versions adjust the value of the index register before accessing the memory location affected by the instruction. The index register retains the changed value after the instruction executes. Post-decrement and post-increment versions of the addressing mode use the initial value in the index register to access the memory location affected by the instruction, then change the value of the index register. The index register can be decremented or incremented by any integer value in the ranges -8 through -1 or 1 through 8 LDAA 1,-X STX 3,SP+ ;decrement the value in X by one then load accumulator A from the new address in X ;store the value in X at the address pointed at by the stack pointer, and the next address since X is 16 bits, then increase the value of the stack pointer SP by 3 Accumulator offset indexed addressing In this addressing mode the effective address is the sum of the value in the base index register and the unsigned offset in one of the accumulators. The value in the index register itself is not changed. The index register can be X, Y, SP or PC and the accumulator can be either of the 8-bit accumulators (A or B) or the 16-bit D accumulator LDAA B,X ;load accumulator A from the new address formed by the sum of the value in index register X and the value in accumulator B Accumulator D indirect indexed addressing In this addressing mode the value in the D accumulator is added to the value in the base index register to form the address of a memory location that contains a pointer to the mem- page 4

ory location affected by the instruction. The instruction operand does not point to the address of the memory location to be acted on, but rather to the location of a pointer to the address to be acted on. The square brackets distinguish this addressing mode from 16-bit constant offset indexing JMP [D,X] ;jump to the address that is stored at the memory location pointed at by the sum of the value in D and the value in X page 5