EE3170/CC/Lecture#6 1 EE 3170 Microcontroller Applications Lecture 6 : Instruction Subset & Machine Language: Addressing Modes in Motorola 68HC11 - Miller §2.1 & §2.2 & §2.3 Based on slides for ECE3170 by Profs. Davis, Kieckhafer, Tan, and Cischke EE3170/CC/Lecture#6 2 Lecture Overview More Instructions Example: first assembly language program Addressing Modes Introduction, definitions, and notation The 68HC11 Addressing Modes definition address calculation advantages and disadvantages common uses EE3170/CC/Lecture#6 3 A Few More Instructions Instruction Set Table: Explains operation of instruction Presents additional details There will be more columns later Figure 2-15: Part of the instruction set table Store Accumulator A STAA LDAA Load Accumulator A ADDA Add Memory to A BB hh ll Op Code A M Operand Machine Code Bytes STOP Stop program 3F B6 B7 hh ll hh ll 3 3 3 1 Source Form Operation Boolean Expression A+M A M A EE3170/CC/Lecture#6 4 Instruction Format From Reference Manual Each ONE of the TEN encodings is a different format (or addressing mode) for the same LDA instruction Only concern ourselves with one at a time Source: 68HC11 Reference Manual (http://www.technologicalarts.com/myfiles/links.html)
13
Embed
More Instructions EE 3170 Microcontroller Applications 3170 Lecture 6-part1... · format (or addressing mode) for the same LDA instruction ... “Concatenated-Address” Modes Extended
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
EE3170/CC/Lecture#6 1
EE 3170 Microcontroller ApplicationsLecture 6 : Instruction Subset & Machine Language: Addressing Modes in Motorola 68HC11- Miller §2.1 & §2.2 & §2.3
Based on slides for ECE3170 by Profs. Davis, Kieckhafer, Tan, and Cischke
EE3170/CC/Lecture#6 2
Lecture OverviewMore Instructions
Example: first assembly language program
Addressing ModesIntroduction, definitions, and notation
The 68HC11 Addressing Modesdefinitionaddress calculationadvantages and disadvantagescommon uses
EE3170/CC/Lecture#6 3
A Few More InstructionsInstruction Set Table:
Explains operation of instructionPresents additional detailsThere will be more columns later
Figure 2-15: Part of the instruction set table
Store Accumulator ASTAALDAA Load Accumulator AADDA Add Memory to A BB hh ll
OpCode
A M
Operand
Machine Code
Byte
s
STOP Stop program 3F
B6B7
hh llhh ll
3331
SourceForm
OperationBoolean
Expression
A+M AM A
EE3170/CC/Lecture#6 4
Instruction Format
From Reference Manual
Each ONE of the TEN encodings is a different format (or addressing mode) for the same LDA instruction
Available at: http://www.freescale.com/files/microcontrollers/
doc/ref_manual/M68HC11ERG.pdf
EE3170/CC/Lecture#6 12
Programming Reference Guide
Available at: http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11ERG.pdf
EE3170/CC/Lecture#6 13
How Can We Address Memory? -Addressing Modes
So far, all data addresses have been embedded in their entirety within the instruction
This approach can have disadvantages:It takes a lot of space in the instruction,
68HC11: 64KB address space ⇒ 2 bytes / addressPentium et al: 4GB address space ⇒ 4 bytes / address
It takes extra clock ticks to fetch the whole addressMay need to calculate or modify address at run-time
an array entrya linked list pointer
We need a shorter, faster way to address memory.EE3170/CC/Lecture#6 14
DefinitionsEA = Effective Address = the complete 16-bit address of a data item in memory
Addressing Mode = a method the processor uses to calculate an effective address, including:
The information used in the calculationThe algorithm used in the calculation
EE3170/CC/Lecture#6 15
Notationhh = high-order byte of an addressll = low-order byte of an addressdd = one byte of dataM = a one-byte memory word“:” = concatenation:
hh:ll = full 16-bit address00 : value = unsigned byte zero-extended to 16-bitsss : value = signed byte sign-extended to 16 bitsM:(M-1) = 16-bit concat. of two adjacent mem. bytes
Inherent Addressingn/a : no memory access – uses registers
Immediate Addressingn/a : no memory access – data contained in machine code
Indexed AddressingEA = index + 00 : offset
Relative AddressingEA = PC + ss : offset
EE3170/CC/Lecture#6 18
1. Extended AddressingDefinition:
The complete address is contained in the instructionExactly what we have been looking at
Instruction: Opcode hh ll
EA Calculation: EA = hh:ll
Range: 0000 …FFFFEntire Address Space
EE3170/CC/Lecture#6 19
1. Extended AddressingAdvantages:
can access the entire address space
Disadvantages:Requires two bytes in the instruction for addressRequires two clock ticks to fetch the addressAddress of the data must be known at assembly time