As well as hardware for executing instructions, a processor needs hardware to access data. Principally, hardware is needed to read and write data to and from registers and memory. The capabilities of the accessing hardware are reflected in the processor’s instruction set in the so-called addressing modes. Hence, the term ‘addressing modes’ refers to the allowable ways in which the processor instructions can refer to data. CISC processors tend to have many different addressing modes whilst RISC processors tend to have a very small number of addressing modes. In this lecture, we will introduce the three fundamental addressing modes on the 68000: immediate, absolute and indirect. We will also look at some variations of the immediate and direct modes.
Learning Outcomes:
On completion of this lecture, you will be able to:
7.1 Categories of addressing modes
You select an appropriate addressing mode for a piece of data depending on how much you know about the data item itself when you’re writing the program:
Level of Knowledge of Data |
Kind of Addressing Mode |
Value can be known at assembly time |
Immediate Mode |
Location can be known at assembly time |
Direct Mode |
Location or value can be calculated at run time |
Indirect Mode |
The 68000 has fourteen addressing modes and we will look at eleven of them through the course:
7.2 Immediate Addressing Modes
We have already encountered immediate addressing in which the actual operand is supplied with the instruction. We will describe two types of immediate addressing modes: immediate and quick immediate.
7.2.1 Immediate
#21,
#$60FA,
#$12234-$24
#(567*$ab)-’x’
#61+D0
#$74+(A4)
Why?
Some instructions and operands occur very frequently in the instruction execution stream, and some of these are speeded up by making the instruction shorter:
Each of these instructions expects a ‘quick immediate’ operand with a restricted range of values.
MOVEQ (Move Quick):
ADDQ and SUBQ (Add and Subtract Quick)
If the Operand is in a Register (‘Register Direct’) you can use:
If the Operand is in Memory (‘Memory Direct’) you may use:
Memory Direct modes are used to specify where an operand is in memory.
21,
$12FA,
$6534-21+’a’
Address Space
The 68000 processor family, being a fully 32-bit family, has a 32-bit address space (i.e. 232 distinct byte locations in memory.)
The 68000 itself only uses 24 bits of the available address space. This is a hardware restriction of the 68000 itself. To write portable code, write for a 32-bit address space.
Two Memory Direct Modes
For reasons that are perhaps partly historical and partly speed motivated, the 68000 has:
A 16-bit address is an address represented by only 16 bits, thus only 216 (i.e. 65536) distinct locations can be specified.
Absolute Memory Long
$f0463047,
$1048-21+’a’
etc.
Absolute Memory Short
To save space in an instruction, an abbreviated address can be stored in 16 bits. It is sign-extended to the full 32 bits when needed. This means the range of addresses is limited to:
$00000000 – $00007FFF, $FFFF8000 – $FFFFFFFF, i.e. the bottom 32768 and the top 32768 of addresses in the full 32-bit address space
Because it is only 16 bits, the instruction of which it is part is fetched faster.
We will look at five indirect addressing modes in the course, but now we’ll just look at one -- ‘Address Register Indirect.’ You can make up the functionality of most the other indirect addressing modes from this; they are provided for convenience and speed.
Motivation for Indirection
The 68000 has eight address registers, A0 to A7, which are exploited in the address register indirect addressing. In this indirect addressing mode, the address of an operand is found in an address register, rather than in the instruction. Address register indirect is indicated to the assembler by enclosing an address register in round parentheses.
e.g: CLR (A0) means: clear the contents of the memory location whose address is the contents of address register (A0).
To access an operand two accesses must be made: the first is to the address register to find the actual address of the operand and the second is to the operand itself.
Since the registers are on the chip along with the CPU, little time is lost reading their contents to locate the operand in memory.
Addressing modes are concerned with how an operand is located by the CPU.
Immediate addressing, also known as literal addressing, allows you to specify a constant as an operand: the value following the instruction op-code is the actual operand itself. In 68000 assembly language, the symbol # precedes the operand to indicate immediate addressing. Immediate addressing is used whenever the value of the operand is known at the time the program is written.
In direct, also called absolute, addressing the operand field of the instruction provides the address of the operand in memory. Direct addressing is used whenever the address of a variable is constant.
Address register indirect addressing uses an address register to point at the location of an operand in memory. This addressing mode is indicated to the 68000 assembler by enclosing the address register in round parentheses.
REFERENCES
Source: http://www.mee.tcd.ie/~assambc/3d1_l07n.doc
Web site to visit: http://www.mee.tcd.ie
Author of the text: indicated on the source document of the above text
If you are the author of the text above and you not agree to share your knowledge for teaching, research, scholarship (for fair use as indicated in the United States copyrigh low) please send us an e-mail and we will remove your text quickly. Fair use is a limitation and exception to the exclusive right granted by copyright law to the author of a creative work. In United States copyright law, fair use is a doctrine that permits limited use of copyrighted material without acquiring permission from the rights holders. Examples of fair use include commentary, search engines, criticism, news reporting, research, teaching, library archiving and scholarship. It provides for the legal, unlicensed citation or incorporation of copyrighted material in another author's work under a four-factor balancing test. (source: http://en.wikipedia.org/wiki/Fair_use)
The information of medicine and health contained in the site are of a general nature and purpose which is purely informative and for this reason may not replace in any case, the council of a doctor or a qualified entity legally to the profession.
The texts are the property of their respective authors and we thank them for giving us the opportunity to share for free to students, teachers and users of the Web their texts will used only for illustrative educational and scientific purposes only.
All the information in our site are given for nonprofit educational purposes