Professional Documents
Culture Documents
Chapter 3
Addressing Modes
C54x
C55x
y = x1 + x0 + x2 init[3] x[3]
Procedure
Allocate sections (code, constants, vars)
Setup addressing modes
Add the values (x1 + x0 + x2)
Store the result (y)
Named
sections, name .sect .usect
given by user
Unnamed
sections, .text .data .bss
default name
System Diagram
Short value
3, 5, 8, 9 bits constant Example:
1 word, 1 cycle LD #6, DP
To initialize short Load DP with the value 6.
length registers or bit
fields:
DP, ASM …
Not always available
SIEE, Slide 16 Copyrig
Example: MMR (Memory Mapped Registers)
and Immediate Addressing
.sect ”init" STM (STore to Memory-mapped
tbl .int 1,2,3 register) stores an immediate
value to the specified MMR or
x .usect "vars",3 Scratch address.
y .usect "result",1
.sect “code”
start: STM #tbl,AR1 #tbl is the 16-bit address of the
STM #x,AR2
first element of the array tbl.
0000
h MMR = Memory Mapped Registers
MMRs
0060
h Scratch Scratch memory
007F
128 0080
Page 1 128 words
256 0100
Page 2 128 words
512 Pages
DP register 9-bit DP
SP relative, CPL = 1
SP Register 16-bit Stack Pointer
+ 7-bit dma
Page 3 to 510
x .usect "vars",3
y .usect "result",1
.sect “code”
start: STM #tbl,AR1
STM #x,AR2
ARi
End_address =
xxxxxxxxxxx11111
x .usect "vars",3
y .usect "result",1
.sect “code”
start: STM #tbl,AR1
STM #x,AR2 Initialization of AR1 and AR2.
LD *AR1+,A
Copy the values from table in DROM
STL A,*AR2+ ;... to RAM (via A). Indirect addressing
allows sequential access to data.
LD #x,DP System Diagram
LD @x+1,A
ADD @x,A DROM RAM
ADD @x+2,A
tbl[3] x[3]
LD @x+1,A
ADD @x,A
ADD @x+2,A
0000h
MMRs Tip: use the .mmregs directive
to allow MMR names to be
interpreted as addresses
0060h
Scratch
007Fh
+ 7-bit @x
= 23-bit address
= 23-bit address
AADD #const,AR1
ASUB AR1,T0
AMOV #k23,XAR2
.dp x
indir: AMOV #x,XAR0
AMOV #tbl,XAR6
COPY: MOV +
*AR6+, +
AR0+
MOV *AR6+,*AR0+
MOV *AR6 ,*AR0
ROM RAM 55xx
dir: AMOV #x,XDP CPU
tbl[4] x[4]
ADD: MOV @(x+0),AC0 I P
y = x0 + x1 + RAM
ADD @(x+1),AC0 D A
ADD @(x+2),AC0 x1 y
.dp x
indir: AMOV #x,XAR0
AMOV #tbl,XAR6
BSET/BCLR bit_name
BCLR ARMS ;clear ARMS
BSET CPL ;set CPL
BCLR C54CM ;clear C54CM