![NEC mPD17120 Subseries User Manual Download Page 217](http://html.mh-extra.com/html/nec/mpd17120-subseries/mpd17120-subseries_user-manual_249259217.webp)
CHAPTER 18 INSTRUCTION SET
202
MOV
MEM000, #00H
; Writes 0 to data memory indicated by index register
CLR1
IXE
; IXE flag
←
0
INC
IX
SET2
CMP, Z
; CMP flag
←
1, Z flag
←
1
SUB
IXL, #03H
; Checks whether index register contents
SUBC
IXM, #07H
; are 73H in bank 0
SUBC
IXH, #00H
;
SKT1
Z
; Loops until contents of index register becomes
BR
RAM clear
; 73H of bank 0
18.5.2 Subtraction Instructions
(1)
SUB r, m
Subtract data memory from general register
<1> OP code
10
8 7
4 3
0
00001
m
R
m
C
r
<2> Function
When CMP=0, (r)
←
(r) – (m)
Subtracts the data memory contents from the general register contents, and stores the result in general
register.
When CMP=1, (r) – (m)
The result is not stored in the register. Carry flag CY and zero flag Z are changed, according to the result.
Sets carry flag CY, if a borrow occurs as a result of the subtraction. Resets the carry flag, if no borrow occurs.
If the subtraction result is other than zero, zero flag Z is reset, regardless of compare flag CMP.
If the subtraction result is zero, with the compare flag reset (CMP=0), the zero flag Z is set.
If the subtraction result is zero, with the compare flag set (CMP=1), the zero flag Z is not changed.
Subtraction can be executed in binary 4-bit or BCD. The BCD flag for program status word PSWORD specifies
which kind of subtraction is to be executed.
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 ...