Calculating with Signed Binary Data
Application Example
Macro not used
00000
20001
20000
00001
00002
00200
20501
20500
00201
00202
00500
21001
21000
00501
00502
01000
22001
22000
00101
00102
2-16 Calculating with Signed Binary Data
CPM2A/CPM2C and
SRM1(-V2) Instructions
CPM1/CPM1A Instructions
Signed Data Calculations
158
When a macro is used, the program can be simplified as shown below.
20000
20001
20500
20501
21000
21001
22000
Subroutine used
22001
to define macro
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)
Addition
7 + 3 = 10
(–7) + 3 = –4
7 + (–3) = 4
(–7) + (–3) = –10
Section
Macro used
25313 (Always ON)
MCRO(99)
MCRO(99)
MCRO(99)
MCRO(99)
SBN(92)
23200
23601
23600
23201
23202
RET(93)
Subtraction
7 – 3 = 4
(–7) – 3 = –10
7 – (–3) = 10
(–7) – (–3) = –4
2-16
030
000
200
030
002
205
030
005
210
030
010
220
030
23600
23201
Need help?
Do you have a question about the CPM1 - PROGRAMING MANUAL 02-2001 and is the answer not in the manual?
Questions and answers