Fujitsu MB89950/950A Pager User Manual


 
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
0083H
A
0080
H
0081
H
0082
H
0083H
After execution
1 2 3 4 H
12H
34H
Memory Memory
MOVW 0081H,A
A
Before execution
1 2 3 4 H
0080
H
0081
H
0082
H
0083H
A
0080
H
0081
H
0082
H
0083H
After execution
1 2 3 4 H
12H
34H
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