-5+4=-1
works because 0 - 5 + 4 = -1, and 4+-3=1 works because
4 + 0 - 3 = 1.
plan 2 of the HTA above, detects overflow
by checking the most significant bits of the augend, addend, and sum (subtraction is done
by negating the number after the minus sign, and then adding). There are two overflow
cases:
0
and the most significant bit of the sum is 1, then there is an overflow
1
and the most significant bit of the sum is 0, then there is an overflow
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XOR the carry into E equals 1, and
as can be seen, also happens whenever the MSB of the augend and addend are equal and not equal
to the MSB of the sum.
plan 4.1). The division
is not very good because I made it calculate the quotient by counting the number of times
the divisor would go into the dividend, just like on our last exam. But it is easy and works, so....