Sie sind auf Seite 1von 10

7/16/2014

1
ADDRESSING MODES OF
MICROPROCESSOR 68000
After this session, students should be able:
To introduce the addressing modes.
To explain the types of addressing modes.
To write the programming language using addressing
modes.
To analyze the program.
ADDRESSING MODES
An instruction in the MC68000 contains two types of information:
- The type of operation to be performed.
- The location of the operand(s) on which to perform the function:
the addressing modes.
Addressing modes
The procedure of fetching and sending data between source and
destinations is carried out by various addressing approaches .
Objective
To supply different ways for the programmer to generate an effective
address (EA) that identifies the location of an operand.
7/16/2014
2
1.0 REGISTER DIRECT ADDRESSING
Used when one of the data or address registers within the 68000
contains the operand that is to be processed by the instruction.
If the specified register is a data register, the addressing mode is called
data register direct addressing.
If the specified register is a address register, the addressing mode is
called address register direct addressing.
Register direct addressing is the fastest and most compact addressing
mode because no memory reference operation is required for
accessing the operand.
1.1 DATA REGISTER DIRECT
Description
- Data register (D0-D7) is the source or destination of data
Example
REGISTER BEFORE REGISTER AFTER
MOVE.B D0, D3
D0 1020 4FFF D0 1020 4FFF
D3 1034 F88A D3 1034 F8FF
7/16/2014
3
1.1 DATA REGISTER DIRECT
REGISTER BEFORE REGISTER AFTER
CLR.W D3
D3 6789 ABCD D3
CLR.B D6
D6 FFFF FFFF D6
MOVE.W D0, D4
D0 0123 4567 D0
D4 0056 7800 D4
1.2 ADDRESS REGISTER DIRECT
Description
- Address register (A0-A7) is the source or destination of data.
- only word or long word operands may be specified
- a word operand is sign-extended to fit the register
Example
MOVEA.L A3, A0
REGISTER BEFORE REGISTER AFTER
A0 0020 0000 A0 0004 F88A
A3 0004 F88A A3 0004 F88A
7/16/2014
4
1.2 ADDRESS REGISTER DIRECT
REGISTER BEFORE REGISTER AFTER
MOVE.L A3, D5
A3 0123 4567 A3
D5 3333 5555 D5
MOVE.WA3,D5
A3 0123 4567 A3
D5 3333 5555 D5
MOVEA.WD1, A5
D1 ABCD EF00 D1
A5 0000 2000 A5
1.2 ADDRESS REGISTER DIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVEA.WD4, A6
D4 00567800 D4
A6 00400400 A6
00400400 22 7C 00400400
00400402 00 40 00400402
MOVEA.B D4, A6
D4 00567800 D4
A6 00400400 A6
00400400 22 7C 00400400
00400402 00 40 00400402
7/16/2014
5
2.0 REGISTER INDIRECT ADDRESSING
Register indirect addressing is normally called address register indirect
addressing, because is the address register which is indirectly referred.
In the address register direct mode, the content of the specified
address register is the operand required for the operation.
In the address register indirect mode, the specified address register
contains the memory address of an operand.
There are several related modes to this addressing:
Address register indirect
Post increment Address register indirect
Pre decrement Address register indirect
2.1 ADRESS REGISTER INDIRECT
Description
- an address register contains the address of the source or destination
operand
Example
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.L D0, (A0)
D0 1043 834F D0 1043 834F
1000 55 02 1000 10 43
1002 3F 00 1002 83 4F
7/16/2014
6
2.1 ADDRESS REGISTER INDIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
CLR.L (A4)
A4 0040 0406 A4
0040 0406 12 34 0040 0406
0040 0408 56 78 0040 0408
CLR.B (A6)
A6 0040 0400 A6
0040 0400 22 7C
0040 0402 00 40
2.1 ADDRESS REGISTER INDIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.WD4, (A6)
D4 0056 7800 D4
A6 0040 0400 A6
0040 0400 22 7C 0040 0400
7/16/2014
7
2.2 POST-INCREMENT REGISTER INDIRECT
Description
- indicated by a + sign
- after reading or writing data the address register is incremented by
the number of byte transferred
* byte + 1
* word + 2
* long word + 4
Example
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.W (A5)+, (D0)
D0 0000 FFFF D0 0000 4567
A5 0000 1000 A5 0000 1002
0000 1000 45 67 0000 1000 45 67
2.2 POST-INCREMENT REGISTER INDIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
CLR.B (A4)+
A4 0040 0406 A4
0040 0406 12 34 0040 0406
CLR.W (A6)+
A6 0040 0400 A6
0040 0400 22 7C 0040 0400
7/16/2014
8
2.2 POST-INCREMENT REGISTER INDIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.WD4, (A6)+
D4 0056 7800 D4
A6 0040 0400 A6
0040 0400 22 7C 0040 0400
2.3 PRE-DECREMENT REGISTER INDIRECT
Description
- indicated by a - sign
- before reading or writing data the address register is decremented by
the number of byte transferred
* byte - 1
* word - 2
* long word - 4
Example
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.W (D0), -(A7)
D0 0000 0143 D0 0000 0143
A7 0000 1002 A7 0000 1000
0000 1000 83 47 0000 1000 01 43
7/16/2014
9
2.3 PRE-DECREMENT REGISTER INDIRECT
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
CLR.B -(A3)
A3 0123 4567 A3
0123 4567 12 34 0123 4567
MOVE.W D4, -(A4)
D4 0056 7800 D4
A4 0040 0406 A4
0040 0404 00 04 0040 0406
3.0 IMMEDIATE DATA ADDRESSING
The operand itself is stored in the extension word as part of the
instruction. In general, the data are encoded and stored in the word
locations that follow the instruction in program memory.
If the immediate operand is a long word, two extension words are
required.
The immediate addressing mode provides a convenient way for
referencing constants that are occasionally used in a program.
Obviously, immediate operands may serve only as source operands.
REGISTER /
MEMORY
BEFORE
REGISTER /
MEMORY
AFTER
MOVE.W #$5, D0
D0 0123 4567 D0 0123 456C
7/16/2014
10
EXERCISE
Step 1
Classify the types of addressing modes for all the instructions.
Step 2
Write the following program using EASy68K.
Step 3
If you change all the instructions of the program to byte (.b)
except (trap dc.w), determine and explain the differences?
INSTRUCTION TYPES OF ADDRESSING MODES
org $400400 * stores program at $400400
move.l #$5,d1
moveal.1 #$400500,a1
move.l a1,a2
move.l d1,d2
add.w (a2)+,d1
move.l d1,d2
move.l d2,-(a1)
add.w #$4,d1
move.l d1,(a1)
trap #11
dc.w 0
end