beautypg.com

NEC PD17062 User Manual

Page 92

background image

92

µ

PD17062

10.3.2 Example Table Referencing Program

This section shows an example table referencing program.

Example

P0A

MEM

0.70H

;

P0B

MEM

0.71H

;

P0C

MEM

0.72H

;

ORG

0000H

START :

BR

MAIN

DATA :

DW

0001H

; Constant data

DW

0002H

;

DW

0004H

;

DW

0008H

;

DW

0010H

;

DW

0020H

;

DW

0040H

;

DW

0080H

;

DW

0100H

;

DW

0200H

;

DW

0400H

;

DW

0800H

;

MAIN :

BANK0

; Built-in macro

SET4

P0ABIO3, P0ABIO2, P0ABIO1, P0ABIO0

SET4

P0BBIO3, P0BBIO2, P0BBIO1, P0BBIO0

MOV

RPL,

#1110B

; Sets general-purpose register to row address 7H of BANK0 .

MOV

AR1,

#(.DL.DATA SHR 4 AND 0FH)

MOV

AR0,

#(.DL.DATA SHR 0 AND 0FH)

; Sets address register to 0001H.

LOOP :

;

#

MOVT

DBF,

@AR

; Transfers the contents of the ROM specified by AR to data

; buffer.

;

$

LD

P0A,

DBF2

; Transfers the contents of data buffer to Port0A (70H),

LD

P0B,

DBF1

; Port0B(71H), and Port0C (72H) port data registers.

LD

P0C,

DBF0

ADD

AR0,

#1

; Increments the contents of data register by one.

ADDC

AR1,

#0

SKNE

AR0,

#0CH

; Writes 0 in AR0 when the value of AR0 reaches 0CH.

MOV

AR0,

#0

;

BR

LOOP