2-16
Section
Calculating with Signed Binary Data
158
Application Example
When a macro is used, the program can be simplified as shown below.
20000
00000
20001
20000
20001
00001
20500
00200
20501
20500
20501
00201
00202
21000
00500
21001
21000
21001
00501
00502
22000
01000
22001
22000
22001
00101
00102
23600
23200
23601
23600
23201
23201
RET(93)
MCRO(99)
030
000
200
MCRO(99)
030
002
205
MCRO(99)
030
005
210
MCRO(99)
030
010
220
25313 (Always ON)
00002
23202
SBN(92)
030
Macro not used
Macro used
Subroutine used
to define macro
2-16 Calculating with Signed Binary Data
The CPM1/CPM1A/CPM2A/SRM1(-V2) allow calculations on signed binary
data. The following instructions manipulate signed binary data. Signed data is
handled using 2’s complements.
The following signed-binary instructions are available in CPM2A, CPM2C, and
SRM1(-V2) PCs:
•
BINARY ADD – ADB(50)
•
BINARY SUBTRACT – SBB(51)
•
2’S COMPLEMENT – NEG(––)
The following signed-binary instructions are available in CPM1/CPM1A PCs:
•
BINARY ADD – ADB(50)
•
BINARY SUBTRACT – SBB(51)
Signed Data Calculations
Addition
7 + 3 = 10
(–7) + 3 = –4
7 + (–3) = 4
(–7) + (–3) = –10
Subtraction
7 – 3 = 4
(–7) – 3 = –10
7 – (–3) = 10
(–7) – (–3) = –4
CPM2A/CPM2C and
SRM1(-V2) Instructions
CPM1/CPM1A Instructions