Direct Addressing
Direct Addressing
Direct Addressing
–
–
Example
Example
Z = X + Y
Z = X + Y
x .
x .
usect
usect
“samp”,3
“samp”,3
.sect “code”
.sect “code”
MOV
MOV
AL,@x
AL,@x
MOVW DP,#x
MOVW DP,#x
ADD
ADD
AL,@y
AL,@y
MOV
MOV
@z, AL
@z, AL
Data Memory
address
address
data
data
0001C0
0001C0
0001
0001
…
…
…
…
x:
x:
0001FD
0001FD
1000
1000
y:
y:
0001FE
0001FE
0500
0500
z:
z:
0001FF
0001FF
64
64
Page7[00]
Page7[00]
...
...
Page7[3D]
Page7[3D]
Page7[3E]
Page7[3E]
Page7[3F]
Page7[3F]
1500
1500
variations:
MOVW DP,#imm ;2W, 16-bit (4 Meg)
MOVZ DP,#imm ;1W, 10-bit (64K)
MOV DP,#imm ;DP(15:10) unchanged
00
00 0000 0000 0001 1111 1111
00 0000 0000 0001 1111 1111
0 0 0 1 F F
0 0 0 1 F F
DP
offset
0 0 0 0 1 5 0 0
0 0 0 0 1 5 0 0
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
Accumulator
DP=0007
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
MOV AL,@x
ADD AL,@y
MOV @z,AL
Direct Addressing
Direct Addressing
–
–
Caveats
Caveats
Z = X + Y
Z = X + Y
x .
x .
usect
usect
“
“
samp
samp
”,3
”,3
.sect “code”
.sect “code”
ADD
ADD
AL,@y
AL,@y
MOV
MOV
@z, AL
@z, AL
Data Memory
address
address
data
data
0001C0
0001C0
0001
0001
…
…
…
…
x:
x:
0001FF
0001FF
1000
1000
y:
y:
000200
000200
0500
0500
…
…
…
…
Page7[00]
Page7[00]
...
...
Page7[3F]
Page7[3F]
Page8[00]
Page8[00]
MOVW DP,#x
MOVW DP,#x
0 0 0 0 1 0 0 1
0 0 0 0 1 0 0 1
0 0 0 7
0 0 0 7
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 7
0 0 0 7
Accumulator
DP=0007
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
0 0 0 7
0 0 0 7
MOV
MOV
AL,@x
AL,@x
0000 0000 0000 0001 1111 1111
0000 0000 0000 0001 1111 1111
DP
offset
0000 0000 0000 0010 0000 0000
0000 0000 0000 0010 0000 0000
expecting 1500
expecting 1500
Solution: Group and block variables in ASM file:
x .
x .
usect
usect
“samp”,3
“samp”,3
,1
,1
;
;Force all locations to same data
y .set x+1
y .set x+1
;page (1
;page (1
st
st
hole, else linker error)
hole, else linker error)
z .set x+2
z .set x+2
;Assign vars within block
(X and Y not on the same page)
C28x - Appendix B - Addressing Modes
B - 9
Содержание C28 Series
Страница 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Страница 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Страница 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Страница 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Страница 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Страница 275: ...Appendix eZdsp F2812 eZdsp F2812 Connector Header and Pin Diagram C28x Appendix A eZdsp F2812 A 3 ...
Страница 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Страница 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Страница 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Страница 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Страница 281: ...Appendix JP7 JP8 JP11 JP12 Boot Mode Select JP9 PLL Disable DS1 DS2 LEDs C28x Appendix A eZdsp F2812 A 9 ...
Страница 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...