NEC PD75402A Base Correction Instructions, Base correction at addition, Adds Addc, 150

Models: PD75402A PD75P402

1 195
Download 195 pages 45.34 Kb
Page 161
Image 161

CHAPTER 9. INSTRUCTION SET

9.1.3Base 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.4Skip 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.

150

Page 161
Image 161
NEC PD75402A, PD75P402 user manual Base Correction Instructions, Base correction at addition, Adds Addc, 150