numbers
The basic rules for adding binary
integer numbers
1. The subtraction operation is changed by the addition
operation with a negative number.
2. Summands must have the same number of digits.
Insignificant zeros can be added to the left of an integer
part of a number.
3. Every summands are represent in modified Inverse or
Complement codes. Added insignificant zeros change
their significance with transformations according to the
general rule.
The basic rules for adding binary
integer numbers
4. Bit of sign take part in an additional operation
the same way the others bits.
5. For invert code if a carry bit is 1, should to
add this value to the low bit of sum.
6. When using a complement code a carry bit is
lost.
7. The result of a sign is generated automatically.
The basic rules for adding binary
integer numbers
8. The result of adding is represented in the code of
summands.
9. If the sign digits are different, it's overflow of a bit grid.
We should shift the information bits by one bit right. Then
we need to add one bit before sign bit and duplicated in
this bit the value of the leftmost sign bit.
10.For checking, the result of adding is converted into the
direct code.
Example 1. Part 1.
A = 710 B = 2510. Perform operations C = A - B in the
complement codes.
XOR AX,AX Reset AX AX: 00 00
XOR BX,BX Reset BX BX: 00 00
MOV AX, A Moving A=7 10 h AX: 00 07 AX:0000 0000 0000 0111
into register АХ 0 0 0 7
MOV BX, B Moving number BX: 00 19 BX: 0000 0000 0001 1001
B=2510 into 0 0 1 9
register BХ
NOT BX Inversion BX BX:FF E6 BX:0000 0000 0001 1001
BX:1111 1111 1110 0110
F F E 6
ADD BX,1 Additional BX: FF E7 BX: 1111 1111 1110 0110
BX,1 0000 0000 0000 0001
1111 1111 1110 0111
F F E 7
Example 1. Part 2.
=32+16+4+2+0,0625+0.0313 = 54.09375
We expected C10 =54.1. But since only 6 bits were
used to the fractional part, the result contains an
error. Relative error is about 6%.
Thanks for your attention