beautypg.com

Base correction instructions – NEC PD75402A User Manual

Page 161

background image

150

CHAPTER 9. INSTRUCTION SET

9.1.3

Base Correction Instructions

Depending on the application, the result of addition of 4-bit data must be converted to decimal numbers or to

base-6, such as time.

Base correction instructions for converting the result of addition of 4-bit data to an arbitrary base are available

with the

µ

PD75402A instruction set.

(a)

Base correction at addition

If the base value to be corrected is made m, accumulator and memory (HL) are added and the sum is converted

to base-m by combination:

ADDS A,

#16-m

ADDC A,

@HL

; A, CY

A + (HL) + CY

ADDS A,

#m

Overflow remains in the carry flag.

When a carry is output as a result of execution of the ADDC A, @HL instruction, the following ADDS A, #n4

instruction is skipped. If carry is not output, the ADDS A, #n4 instruction is executed. At this time, this instruction

skip function is disabled and the next instruction is not skipped even if carry is output as the result of addition.

Therefore, the program can continue after the ADDS A, #n4 instruction.

Example

Decimal add accumulator and memory.

ADDS

A,

#6

ADDC

A,

@HL

; A, CY

A + (HL) + CY

ADDS

A,

#10

9.1.4

Skip Instruction and Number of Machine Cycles Required by Skip

With the

µ

PD75402A instruction set, a program is formed by condition judgment by skip.

If the skip condition is satisfied when a skip instruction is executed, the following instruction is skipped and the

instruction after the instruction is executed.

When a skip was generated, one machine cycle is required to skip.

This manual is related to the following products: