![NEC mPD17120 Subseries User Manual Download Page 109](http://html.mh-extra.com/html/nec/mpd17120-subseries/mpd17120-subseries_user-manual_249259109.webp)
CHAPTER 11 ARITHMETIC AND LOGIC UNIT
94
Caution should be taken with regard to the following points:
(1) Arithmetic operations are affected by the CMP and BCD flags in the program status word.
(2) Logical operations are not affected by the CMP or BCD flag in the program status word. Logical operations
do not affect the Z or CY flags.
(3) Bit evaluation causes the CMP flag in the program status word to be reset.
(4) When an arithmetic operation, logical operation, bit evaluation, comparison evaluation, or rotation is being
executed and the IXE flag in the program status word is set (1), address modification is performed using the
index register.
11.3 ARITHMETIC OPERATIONS (ADDITION AND SUBTRACTION IN 4-BIT BINARY AND BCD)
As shown in Table 11-3, arithmetic operations consist of addition, subtraction, addition with carry, and subtraction
with borrow. These instructions are ADD, ADDC, SUB, and SUBC.
The ADD, ADDC, SUB, and SUBC instructions are further divided into addition and subtraction of the general
register and data memory and addition and subtraction of data memory and immediate data. When the operands
r and m are used, addition or subtraction is performed using the general register and data memory. When the
operands m and #n4 are used, addition or subtraction is performed using data memory and immediate data.
Arithmetic operations are affected by the status flip-flop and the program status word (PSWORD) in the system
register. The BCD flag in the program status word is used to specify whether arithmetic operations are to be
performed in 4-bit binary or in BCD. The CMP flag is used to specify whether or not the results of arithmetic operations
are to be stored.
11.3.1
to
11.3.4
explain the relationship between each command and the program status word.
Table 11-3. Types of Arithmetic Operations
Arithmetic
Addition
Without carry ADD
General register and data memory
ADD r, m
operation
Data memory and immediate data
ADD m, #n4
With carry ADDC
General register and data memory
ADDC r, m
Data memory and immediate data
ADDC m, #n4
Subtraction
Without borrow SUB
General register and data memory
SUB r, m
Data memory and immediate data
SUB m, #n4
With borrow SUBC
General register and data memory
SUBC r, m
Data memory and immediate data
SUBC m, #n4
Summary of Contents for mPD17120 Subseries
Page 15: ... x MEMO ...
Page 23: ... MEMO 8 ...
Page 45: ... MEMO 30 ...
Page 49: ... MEMO 34 ...
Page 55: ... MEMO 40 ...
Page 93: ... MEMO 78 ...
Page 99: ... MEMO 84 ...
Page 102: ...CHAPTER 11 ARITHMETIC AND LOGIC UNIT 87 MEMO ...
Page 119: ... MEMO 104 ...
Page 175: ... MEMO 160 ...
Page 199: ... MEMO 184 ...
Page 265: ... MEMO 250 ...
Page 281: ...266 MEMO ...
Page 285: ... MEMO 270 ...
Page 289: ... MEMO 274 ...