Base 2 Base 8 Base 10 Base 16 1110.1011 16.54 14.6875 D.B 101.010 5.2 5.25 5.4 1010.0111 12.34 10.4375 A.7 111001.11 74.6 57.75 39.C 1010.111 12.7 10.875 A.E
_ _ _ _ _ _ _ _ |_|_|_|_|_|_|_|_| |s| exp | man | biased 2's comp 7 The largest positive is 0 1111 111 = .875 x 2 = 112 7 The most negative is 1 1111 000 = -1 x 2 = -128 -8 The smallest positive is 0 0000 001 = .125 x 2 = .0004882812 -8 The largest negative is 1 0000 111 = -.125 x 2 = -.0004882812Note that, depending on how you normaliz the numbers, there are other sensible answers to the final three parts. Full credit was given for these alternatives.
; A is in D0.W. ; B is in memory, pointed to by A0. ; C is in field F of a record in memory, ; A1 points to the record, ; the symbol F gives the offset of the field. MULS.W D0,(A0) ; compute A*B ARS.L #7,D0 ; align the point ADD.W (A0) ADD.W (A0) ; compute A*B + 2*B ADD.W F(A1) ; compute result ; D1.W contains A*B + 2*B + C
FIBO: ; function to compute the Nth fibonacci number. ; FIBO(N) = FIBO(N-1) + FIBO(N-2) ; FIBO(1) = 1 ; FIBO(0) = 0 ; accepts N in D0 ; returns FIBO(N) in D0 ; destroys D1 ; preserves or does not use D2-D7,A0-A7,SP
T1 = A + B + 06666666666; T2 = T1 & 06060606060; SUM = T1 - (T2 | (T2 >>3));In M68000 assembly language, this is:
BCDADD: ; add 2 5-digit BCD numbers, packed 1 digit per 6 bits ; given A and B in D0 and D1 ; returns A+B in D0 ; preserves all other registers MOVE.L D1,-(SP) ; save registers ADD.L #@6666666666,D0 ADD.L D1,D0 ; D0 = D0 + D1 + @6666666666 MOVE.L #@6060606060 AND.L D0,D1 ; D1 = D0 & @6060606060 SUB.L D1,D0 ; D0 = D0 - D1 ARS.L #3,D1 SUB.L D1,D0 ; D0 = D0 - (D1 >> 3) MOVE.L (SP)+,D1 ; restore registers RTS