26
CHAPTER 3 CPU
3.1.2
Storing 16-bit Data in Memory
For 16-bit data and the stack, store the upper data in the lower memory address value.
■
Storing 16-bit data in RAM
When writing 16-bit data to memory, store the upper byte at the lower address and the lower byte at the
next address. Handle reading of 16-bit data in the same way.
Figure 3.1-2 "Storing 16-bit data in memory" shows how 16-bit data is stored in memory.
Figure 3.1-2 Storing 16-bit data in memory
■
Storing 16-bit operands
The same byte order applies when specifying a 16-bit operand in an instruction. Store the upper byte at the
address following the operation code (instruction) and the lower byte at the next address.
The byte ordering applies to both 16-bit immediate data and operands that specify a memory address.
Figure 3.1-3 "Byte order of 16-bit data in an instruction" shows how 16-bit data is stored in an instruction.
Figure 3.1-3 Byte order of 16-bit data in an instruction
■
Storing 16-bit data on stack
The same byte order applies when saving 16-bit register data on the stack during an interrupt or similar.
The upper byte is stored in the lower address.
Before execution
1 2 3 4
H
0080
H
0081
H
0082
H
0083
H
A
0080
H
0081
H
0082
H
0083
H
After execution
1 2 3 4
H
12
H
34
H
Memory
Memory
MOVW 0081H,A
A
Before execution
1 2 3 4
H
0080
H
0081
H
0082
H
0083
H
A
0080
H
0081
H
0082
H
0083
H
After execution
1 2 3 4
H
12
H
34
H
Memory
Memory
MOVW 0081H,A
A
.
.
.
[Example]
MOV A,5678H
; Extended address
MOVW A,#1234H
; 16-bit immediate data
X X X 0
H
XX XX
X X X 2
H
60 56 78
; Extended address
X X X 5
H
E4 12 34
; 16-bit immediate data
X X X 8
H
XX
.
.
.
After assembly
Summary of Contents for MB89950 Series
Page 2: ......
Page 3: ...FUJITSU LIMITED F2MC 8L 8 BIT MICROCONTROLLER MB89950 950A Series HARDWARE MANUAL ...
Page 4: ......
Page 10: ...vi ...
Page 34: ...20 CHAPTER 2 HANDLING DEVICES ...
Page 134: ...120 CHAPTER 6 WATCHDOG TIMER ...
Page 236: ...222 CHAPTER 10 UART ...
Page 276: ...262 CHAPTER 12 LCD CONTROLLER DRIVER ...
Page 310: ...296 APPENDIX ...
Page 311: ...297 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 316: ...302 INDEX ...
Page 318: ......