13.1 Assignment 1
Due: 9.00AM on Monday 14th April 2008 (beginning of Week 6)
Overview
This assignment will contribute 10% of your overall assessment for the course. Recall
that you must pass all three hurdles (WebLearn tests, assignments and exam) in order
to complete the course.
• This assignment specification is subject to change. Ensure that you keep up to date
with the Official Announcements forum of the course’s Blackboard.
• Refer to page 196 onwards for submission requirements applicable to this assignment,
i.e. what to submit and how.
• Refer to page 200 for details on late submissions and extensions.
Section 1: Data representation 25 marks
Answer the following questions. To receive full marks you must show all working.
Answers with inadequate working will receive zero marks.
Question 1 3 × 1 = 3 marks
Convert the binary number 0101 1010 1101 into octal, hexadecimal and decimal.
Octal: 2655
010 = 2 | 110 = 6 | 101 = 5 | 101 = 5
Hexadecimal: 5AD
0101 | 1010 | 1101
Decimal: 1453
0101 1010 1101
1 + 4 + 8 + 32 + 128 + 256 + 1024
Question 2 3 × 3 = 9 marks
Perform the following binary arithmetic, showing all carry/borrow bits and stating
8-bit validity for both unsigned and 2’s complement interpretations
1011 0011 + 1110 1100
2's complement;
1111 (carry)
1011 0011
+1110 1100
11001 1111 (VALID)
8bit;
1111 (carry)
1011 0011
+1110 1100
11001 1111 (INVALID)
1001 0110 − 0010 0011
2's complement;
10 11 1 (carry)
1001 0110
-0010 0011
1101 1100
+1 1101 1101
0111 0011 (INVALID)
8bit;
1 11 (borrow)
10010110
-00100011
01110011 (VALID)
0011 1011 − 1001 1010
2's complement;
01111 111 (Carry)
0011 1011
1001 1010
0110 0101
+1 0110 0111
1010 0010 (INVALID)
8bit;
1 (borrow)
0011 1011
-1001 1010
0010 0001 (INVALID)
13.1. ASSIGNMENT 1 203
Question 3 2 × 2 = 4 marks
Perform the following arithmetic in hexadecimal assuming unsigned data, again showing
all carry/borrow bits and stating whether the solution is valid:
a) $ ABCD + $ 2FEE
1 11 (Carry)
$ABCD
+ $2FEE
$DBBB (VALID)
b) $ D3FD − $ ABBA
1 (Borrow)
$D3FD
- $ABBA
$2843 (Valid)
Question 4 4 marks
Convert the decimal value 0.39375 into an 8-bit binary fraction.
Question 5 5 marks
Perform the following multiplication twice (once interpreting the data as unsigned, and
once interpreting the data as signed):
% 1001 1110 × % 110
Unsigned;
1001 1110
x 110
0000 0000
1111 1100
1111 1000
0100
(carry)
Section 2: Assembly language programming 5 marks
NOTE TO MARKER:
I completely rewrote the code for this part, I didn't believe we had to use the sample code and then modify it until I reread over the assignment just before submitting to find that we were meant to do that. I believe though that my code still does the requirements so I shall submit it in the hope to get some marks still! Screen shots provided below.
Thanks
Code;
org $1000
move.l #$7ffe,sp ;init stack pointer
move.w $2000,d1 ;get data 1
move.w $2002,d2 ;get data 2
move.w $2004,d3 ;get data 3
move.w $2006,d4 ;get data 4
add.w $2000,d2 ;add d1 result 1
move.w d2,result1 ;Save Result
move.w result1,$2008 ;Save Result
add.w $2004,d4 ;add d3 to d4
move.w d4,result2 ;
move.w result2,$2010 ;Save Result
move.b #228,d7 ;return to simulator
trap #14 ;
org $2500
result1 dc.w 1 ;
result2 dc.w 2 ;
end ;no more to assemble
Screen shot;