Hide thumbs Also See for CPM1:
Table of Contents

Advertisement

Binary Calculation Instructions
Flags
Example
00001
298
and places the result in R. If the result is negative, CY is set and the 2's com-
plement of the actual result is placed in R.
SBB(51) can also be used to subtract signed binary data. With CQM1-
CPU4@-EV1, CPM1A, and SRM1, the underflow and overflow flags (SR
25404 and SR 25405) indicate whether the result has exceeded the lower or
upper limits of the 16-bit signed binary data range.
Indirectly addressed DM word is non-existent. (Content of *DM word
ER:
is not BCD, or the DM area boundary has been exceeded.)
CY:
ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ:
ON when the result is 0.
OF:
ON when the result exceeds +32,767 (7FFF).
(CQM1-CPU4@-EV1 only)
UF:
ON when the result is below –32,768 (8000).
(CQM1-CPU4@-EV1 only)
The following example shows a four-digit subtraction. When IR 00001 is ON,
the content of LR 00 and CY are subtracted from the content of IR 002 and
the result is written to HR 01.
CY is turned ON if the result is negative. If normal data is being used, a nega-
tive result (signed binary) must be converted to normal data using NEG(––).
Refer to 5-19-17 2'S COMPLEMENT – NEG(––) for details.
In the case below, the content of LR 00 (#7A03) and CY are subtracted from
IR 002 (#F8C5). Since the result is positive, CY is 0.
If the result had been negative, CY would have been set to 1. For normal
(unsigned) data, the result would have to be converted to its 2's complement.
Note For signed binary calculations, the status of the UF and OF flags indicate
whether the result has exceeded the signed binary data range (–32,768
(8000) to +32,767 (7FFF)). (CQM1-CPU4@-EV1 only)
Mi – Su – CY
Address Instruction
00000
CLC(41)
00001
00002

SBB(51)

00003
002
LR00
HR 01
Mi: IR 002
F
8
C
5
Su: LR 00
CY = 0
7
A
0
3
(from CLC(41))
0
0
0
0
R: HR 01
7
E
C
2
Section 5-21
CY
R
Operands
LD
00001
OUT
TR
CLC(41)
SBB(51)
LR
HR
1
002
00
01

Advertisement

Table of Contents
loading

Table of Contents