Name ______________________________________ Section ___________
Base 2 Base 8 Base 10 Base 16 1110.1011 16.54 14.6875 D.B 101.010 ___.___ ___.___ ___.___ ___.___ 12.34 ___.___ ___.___ ___.___ ___.___ 57.75 ___.___ ___.___ ___.___ ___.___ A.E
_ _ _ _ _ _ _ _ |_|_|_|_|_|_|_|_| |s| exp | man |Give the binary values and fixed point decimal equivalents for each of the following numbers (0.4 each, 1.6 total):
The largest positive number. _ _ _ _ _ _ _ _ ____________ The most negative number. _ _ _ _ _ _ _ _ ____________ The smallest nonzero positive number. _ _ _ _ _ _ _ _ ____________ The largest nonzero negative number. _ _ _ _ _ _ _ _ ____________
; 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. ____________________________ ____________________________ ____________________________ ____________________________ ____________________________ ____________________________ ____________________________ ____________________________ ____________________________ ; 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 ______________________________________ ; ; returns FIBO(N) in ________________________________ ; ; destroys __________________________________________ ; ; preserves or does not use _________________________ MOVEQ.L #1,D1 CMP.L D1,D0 BLE FIBQT MOVE.L D0,-(SP) SUBQ.L #1,D0 JSR FIBO MOVE.L D0,D1 MOVE.L (SP),D0 MOVE.L D1,(SP) SUBQ.L #2,D0 JSR FIBO ADD.L (SP)+,D0 FIBQT: RTS
T1 = A + B + 06666666666; T2 = T1 & 06060606060; SUM = T1 - (T2 | (T2 >>3));(The above code is given in C, where the & operator means bit-by-bit Boolean and, the >>3 operator means right shift 3 bits, and a leading zero on a constants means that the radix is octal.) Write a properly commented M68000 procedure called BCDADD that uses this algorithm and conforms to the header comments given. You do not need to understand how or why the algorithm works to solve this problem! (4 points)
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 _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________ _____________________________________________________