beautypg.com

3 notes on using data memory – NEC PD17062 User Manual

Page 38

background image

38

µ

PD17062

5.3 NOTES ON USING DATA MEMORY

5.3.1 Addressing Data Memory

If the 17K series assembler is being used and a numeric representing a data memory address is specified

directly in an operand of a data memory manipulation instruction, as shown in example 1, an error will occur.

This error occurs to facilitate the maintainability of programs and to reduce the number of causes of bugs

when a program is modified. In this data sheet, however, real-address notation is used in the sample programs

to make them easy to understand. When coding an actual program, refer to the assembler instruction manual.

Example 1.

Instructions that result in an error

;

#

MOV 2FH, #0001B

; Address 2FH is specified directly.

;

$

MOV 0.2FH, #0001B

; Address 2FH in BANK0 is specified directly.

Instructions that do not cause an error

;

%

M02F MEM 0.2FH

; Address 2FH of BANK0 is defined symbolically in

MOV M02F, #0001B

; M02F as a memory-type address.

;

&

MOV .MD.2FH, #0001B ; Address 2FH is converted into a memory-type

; address by using .MD.. However, the use of this type of

; instruction should be avoided to reduce the

; likelihood of bugs arising.

Using an assembler pseudo instruction, namely the MEM instruction (symbol definition pseudo instruc-

tion), symbolically define a data memory address in advance.

If a data memory address is defined symbolically, a data memory bank must also be specified, as shown

in example 2.

This data memory bank specification is used when a data memory map is automatically created in the

assembler.

Note that if a symbolically defined data memory address for BANK2 is used in the range of BANK1 in a

program, as shown in example 2, the operation is performed in BANK1 data memory.