CHAPTER 3 CPU
3.1.2
Location of 16-bit Data on Memory
Upper digits of 16-bit data and stack data are stored in lower addresses on memory.
■
16-bit Data Storage State on RAM
When 16-bit data is written into RAM, the upper byte of the data is stored with a lower address and the
lower byte of the data is stored with the next address. 16-bit data is read in the same manner.
Figure 3.1-2 shows the location of 16-bit data on RAM.
■
16-bit Operand Storage State
When 16 bits are specified for operands in instructions, upper bytes are also stored in addresses close to
operation codes (instructions) and lower bytes are stored in the following addresses.
Operands that indicate memory addresses and 16-bit immediate data are handled in the same manner as
stated above.
Figure 3.1-3 shows the locations of 16-bit data in instructions.
■
16-bit Data Storage State in Stack
The upper byte of data for a 16-bit register put in the stack due to an interrupt is also stored with a lower
address.
26
Figure 3.1-2 Location of 16-bit Data on RAM
Before
written
Memory
0080
H
0081
H
1234
A
H
0082
H
0083
H
Figure 3.1-3 Location of 16-bit Data in Instructions
[Example]
MOV A, 5678H
MOV W A, #1234H
XXX0
XX
H
XXX2
60
H
XXX5
E4
H
XXX8
XX
H
After
written
MOVW 0081H, A
1234
A
; Extend address
; 16-bit immediate data
Processed through assembler
. .
.
XX
; Extend address
78
56
12
34
; 16-bit immediate data
. . .
Memory
0080
H
12
0081
H
H
H
34
H
0082
H
0083
H