1. omit 2. (a) 200 repeat: load x ;AC=x 201 add one ;AC=x+1 202 store x ;x=x+1 203 mul x ;AC=x^2 204 sub t ;AC=x^2-58 205 brpos exit ;if (x^2>58) goto exit 206 br repeat ;else goto repeat 207 load x ;AC=x 208 exit: sub one ;AC=x-1 209 store x ;x=x-1 210 halt 211 t: number 58 212 x: number 1 ;initialize x=1 213 one: number 1 (b) It tries to find the max. integer x such that x^2 is less than 58. 3. load two sub n brpos return1 ; if (n<2) goto return1 load i test: sub n brpos exit ; if (n n=1 => return 1 (AC should be 1 now) exit: halt Fib: number 2 ; Fib[n] Fib1: number 1 ; Fib[n-1] i: number 3 ; index variable one: number 1 two: number 2 n: number ???? ; paramemter 4. (a) 10 bits => max = 11...1 (10 1's)=2^10-1=1023 (b) 20 bits => max = 11...1 (20 1's)=2^20 (c) max = 011..1 (19 1's) = 2^19-1 min = 00...01 (19 0's) = -2^19 5. (a) 00101101 = 45 +01101111 =111 --------- 10011100 overflow (b) 11111111 = -1 +11111111 = -1 --------- 111111110 = -2 (c) 00000000 = 0 -11111111 = -1 --------- 00000001 = 1 (d) 11110111 = -9 -11110111 = -9 --------- 00000000 = 0