SN2019 Exam: Answers. Q1
(a) (i)122=01111010=$7A[2]
(ii) 16 is 00010000 so -16 is 11110000 = $F0 [2]
(b) The numbers that can be represented are from -2-15 to +215-1 [2]. For positive numbers extend to 16 bits with a most significant byte of 0; for negative numbers, use a most significant byte of $FF [1].
(c) Many options. E.g. X=00000000 and Y = 11111111. In two¡¯s comp Y is -1 and in unsigned it is 255 so the condition is satisfied.
(d) For example:
CMPLT R2,R1,R0 JUMPT R2,NEG[R0] ADD R3,R1,R0 JUMP DONE[R0]
NEG INV
ADD R3,R3,R4
DONE …
(e) Outline solution…
;for (i=0; i