Homework 3
EECE 417
Program
Purpose
This program is intended to provide experience in dealing with the computer's
variety of data representations.
Program Statement
Write a SASM program that reads in a single positive integer, and prints
it back out in hexadecimal.
A sample execution of the program looks like
Enter an integer (>0): 26
The value in hexadecimal: 1a
Requirements
-
Your program must contain adequate comments (documentation). Such comments
include your name and section number at the top of the program. They also
include a description of the program, as well as variable descriptions
and comments about the code itself.
-
For this program, an integer consists of only the characters '0'-'9', and
is immediately followed by the newline character (0ah). Any other input
is considered bad. For the case of bad input, your program should print
out an error message indicating bad input and then exit. Note that leading
zeros must be handled correctly, since they are included (by this definition)
as good input.
Handing In the Program
For this program, you will need to turn in your source code (the .asm
extension) and your makefile (the .mak extension). No printout
will be turned in. These files must also be turned in on a disk,
or send via email to the instructor. I wil execute the program to
determine if it is correct, so be sure to test your programs extensively.
Homework (25 points)
-
(4 points)
(a) Convert the base 6 value 204 to base 4.
(b) Convert the base 4 value 310021.201 to base 2 (binary).
(c) Convert the base 8 value 615.201 to base 16 (hexadecimal).
(d) Convert the base 2 value 11001101 to base 10 (decimal).
-
(9 points)
Give 8-bit representations to fill in the following table.
decimal sign magnitude two's complement biased-127
13
-2
185
-
(4 points)
What string is represented by the SASM declaration
a_str dd 52656164h
dd 79210000h
-
(5 points)
What is the IEEE single precision floating point representation for
the decimal number -22.25? Give the result in binary and in hexadecimal.
-
(3 points)
What decimal value is represented by the IEEE single precision representation,
given in hexadecimal by 0xc4800000?
Handing In the Homework
For this homework, you will need to turn in a single file containing your
answers to the homework questions. To make grading easier, please name
your file hw1.group.X.txt. No printout will be turned in.