Show your work on all problems. Without it, we can't give partial credit.
Problems 1 - 5
Brookshear, Chapter Two Review Problems (pgs 84 - 85):
5, (Added Thu Oct 15 14:39: Assume the machine
has a subtraction instruction, unlike Brookshear's machine of Appendix C.)
8 a, b, and e,
11,
12,
15-c.
4012 4021
Extra credit
The machine of Appendix C in Brookshear has no
subtraction operation. In class, we added one. This was not actually
necessary, because the operations of Brookshear's machine can be used
to form the two's complement of the contents of a register.
If a number x is represented in the register, forming the two's complement
of x gives the representation of (-x). Then (-x) can be added
to the contents of another register, with
the effect of subtracting x from the contents of the
second register. Note that applying the two's complement algorithm twice
gives you back the same number, so that forming the two's complement of
a negative number (-x) represented in two's complement
will give you the correct representation for
x (= -(-x)).
Give a sequence of machine instructions that takes the
contents of register 1, forms the two's complement, and changes the contents
of register 1 to be that two's complement.
Hint: consider the logic operation XOR (section 2.5).