34
µ
PD17062
5.2 FUNCTIONS OF DATA MEMORY
Data memory can be used to perform, with one instruction, a four-bit operation, comparison, decision, or
transfer of the data in data memory and immediate data (arbitrary data) by executing one of the data memory
manipulation instructions listed in Table 5-1.
If the general-purpose register is used, a four-bit operation, comparison, or transfer between data memory
and the general-purpose register can be performed by a single instruction.
Examples are given below. See Chapters 6 and 7 for details.
Example 1. Operation on data in data memory
;
MOV 35H, #0001B ; Transfer (write) immediate data 0001B to data
; memory address 35H in the currently selected bank.
;
ADD 76H, #0001B ; Add immediate data 0001B to the contents of
; data memory address 76H in the currently selected ;bank.
In instructions and , the currently selected bank is specified in the bank register of the
system register. For an explanation of the bank register, see Chapter 8.
In , the instruction is for addition to the contents of data memory address 76H. Address
76H is part of the system register. Because the system register always exists regardless of
the bank, the ADD instruction eventually adds 0001B to the contents of address 76H of the
system register, regardless of the bank.
Remark For explanation of how to code instructions, see Section 5.3.1.
Example 2. Operation between data memory and the general-purpose register
Assume that the general-purpose register is allocated to row address 1H of BANK0.
;
ADD 7H, 36H ; Add the contents of data memory address 36H in the
; currently selected bank to the contents of the
; general-purpose register location having column address
; 7H, or address 17H of BANK0.
;
LD 7H, 36H ; Transfer the contents of data memory address 36H to
; the general-purpose register location having column
; address 7H.
; In this instruction, the general-purpose register
; location is address 17H of BANK0.
The system register, data buffer, general-purpose register, and port registers can be manipulated in the
same way as data memory by using the data memory manipulation instructions.
Sections 5.2.1 to 5.2.4 describe the functions of these registers.