
239
CHAPTER 11 INSTRUCTION SET
11.1.4 Number System Conversion Instructions
An application may need to convert the result of a 4-bit data addition or subtraction (performed in binary)
to a decimal number. A time-related application may require sexagesimal conversion.
For this reason, the instruction set of the µPD750008 contains number system conversion instructions for
converting the result of a 4-bit data addition or subtraction to a number in an arbitrary number system.
(a) Number system conversion for addition
Let m be a desired number system after conversion. The following combination of instructions adds
the contents of an accumulator to data in memory (HL), then converts the result of the addition to
number system m.
ADDS A,#16 – m
ADDC A,@HL
; A, CY <– A + (HL) + CY
ADDS A,#m
An overflow is set in the carry flag.
If the execution of the instruction ADDC A,@HL generates a carry, the next instruction ADDS A,#n4
is skipped. If no carry is generated, ADDS A,#n4 is executed. In this case, the skip function of this
instruction (ADDS A,#n4) is disabled, so that even if this addition generates a carry, the instruction
following this instruction is not skipped. Accordingly, programs can be written after ADDS A,#n4.
Example An accumulator is added to memory data in decimal.
ADDS A,#6
ADDC A,@HL
; A,CY <– A + (HL) + CY
ADDS A,#10
·
·
·
(b) Number system conversion for subtraction
Let m be a desired number system after conversion. The following combination of instructions
subtracts data in memory (HL) from the contents of an accumulator, then converts the result of the
subtraction to number system m.
SUBC A,@HL
ADDS A,#m
An underflow is set in the carry flag.
If the execution of the instruction SUBC A,@HL generates no borrow, the next instruction ADDS A,#n4
is skipped. If a borrow is generated, the instruction ADDS A, #n4 is executed. In this case, the skip
function of this instruction (ADDS A,#n4) is disabled, so that even if this addition generates a carry,
the instruction following this instruction is not skipped. Accordingly, programs can be written after
ADDS A,#n4.
Summary of Contents for PD750004
Page 8: ... MEMO ...
Page 20: ... xii MEMO ...
Page 234: ...214 µPD750008 USER S MANUAL MEMO ...
Page 244: ...224 µPD750008 USER S MANUAL MEMO ...
Page 248: ...228 µPD750008 USER S MANUAL MEMO ...
Page 254: ...234 µPD75008 USER S MANUAL MEMO ...
Page 328: ...308 µPD750008 USER S MANUAL MEMO ...
Page 330: ...310 µPD750008 USER S MANUAL MEMO ...
Page 342: ...322 µPD750008 USER S MANUAL MEMO ...