68hc11 - addressing modes

18
ECE 265 LECTURE 4 The M68HC11 Address Modes 9/29/2010 1 ECE265

Upload: chandan-das

Post on 27-Apr-2015

284 views

Category:

Documents


18 download

TRANSCRIPT

Page 1: 68hc11 - Addressing Modes

ECE 265 – LECTURE 4

The M68HC11 Address Modes

9/29/2010

1ECE265

Page 2: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Lecture Overview

The M68HC11 Addressing Modes

Special Consideration

Details of the various Addressing modes

(Note: And this is a very simple architecture)

Material from Chapter 2 plus a 68HC11 reference

manual.

9/29/2010

2

ECE265

Page 3: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Special Considerations

To start, look at the programmers model of the

architecture. What registers are available?

9/29/2010ECE265

3

Page 4: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Special Considerations

To start, look at

the programmers

model of the

architecture.

What registers

are available?

9/29/2010ECE265

4

Page 5: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Special Consideration

Consider that there are Index Register and a Stack Pointer.

This indicates that these register will allow for more than simple load and store data transfers.

Will now examine the modes of data transfer permitted.

The 68HC11 architecture support addressing modes that allow the basis to understand the addressing modes on any architecture.

9/29/2010ECE265

5

Page 6: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Immediate Addressing (IMM)

In immediate addressing the instruction itself contains the data to be loaded into the destination.

Consider the instruction

LDAA #$15 This instruction will load $15 into Accumulator A

In memory it will look like: (op code is $86)

9/29/2010ECE265

6

Page 7: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Some examples from text

Load Immediate

LDAA #10 Loading a decimal value

Loads the binary for 10 into A

LDAA #$1C Loads the hexadecimal value $1C in A

LDAA #@03 Loads the octal value 3 into A

LDAA #%11101100 Loads a binary value

LDAA #’C’ Loads the ASCII code for the letter C

9/29/2010ECE265

7

Page 8: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Extended Addressing Mode (EXT)

This addressing mode introduces the concept of the

effective address of an operand.

The effective address of an operand is the address

in memory of the operand and is usually a

calculated value.

This mode also introduces the use of an instruction

prebyte in the machine code of the 68HC11.

Instructions that require a prebyte take 4 bytes of

memory. Prebytes are either $18, $1A, or $CD

9/29/2010ECE265

8

Page 9: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Example of Extended addressing

Machine code and effect

9/29/2010ECE265

9

Page 10: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Direct Addressing (DIR)

In direct addressing the least significant byte of the 16-bit

address of the operand is in the instruction.

The high order byte is taken to be $00. This is how you

access the 256 bytes of RAM.

9/29/2010ECE265

10

Page 11: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Inherent (INH) addressing mode

In this addressing mode all the information required

for execution is contained in the instruction.

No other operand is required.

Examples:

Increment an Accumulator (either A or B)

Accumulator A+Accumulator B Accumulator A

9/29/2010ECE265

11

Page 12: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Relative Addressing Mode (REL)

Relative addressing is much like it sounds. The

address is relative to something else.

In the case of the 68HC11 relative addressing mode

is used only for branch instructions.

It is a 2 byte instruction with the second byte being

the offset (-128 to +127) to take if the condition is

TRUE.

When the condition is not met, execution continues

with the next instruction.

9/29/2010ECE265

12

Page 13: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

BCC example of relative (REL)

9/29/2010ECE265

13

Page 14: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU 9/29/2010ECE265

14

Page 15: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Indexed Addressing Mode

There are two index address registers, X and Y,

providing two indexed addressing modes, INDX

and INDY.

The value in the indexed register is added to an

offset contained in the instruction to obtain the

effective address of the operand.

This is best seen by an example

9/29/2010ECE265

15

Page 16: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Indexed Mode example

9/29/2010ECE265

16

Page 17: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Lecture summary

9/29/2010ECE265

17

Have covered

The addressing Modes of the 68HC11

What the modes are and how they provide access to

the operand of the instruction

What an effective address is.

Page 18: 68hc11 - Addressing Modes

Joanne E. DeGroat, OSU

Assignment

9/29/2010ECE265

18

Read Chapter 3.1 through 3.6

HW 2 Problems

2.4

2.6

2.19

2.21