Homework 1
As you are aware, we have lab assignments due every week. We also will
have several homework assignments this semester, and this is the first.
While the labs are directed, the homework assignments present larger problems
that you should break down into smaller problems. You should spend some
time thinking about and planning your homework solutions before coding
them.
Program Description
In this assignment, you are to create an assembly language program
to compute the sum for
a list of 3 numbers which are internally defined in the data segment of
your program. The 3 numbers should actually be characters: use
the last 3 digits of your student ID number.
Store the digits as a character string, e.g. "123".
Have your program print "Digits: " followed by the digits,
and a new-line character,
then "the sum of the values is " followed by the sum
(an integer value) and another new-line character.
For example, the digits "123" should have a sum of 6.
For this assignment, you do not have to validate the input.
That is, your program should work with any 3 character sequence,
such as "abc" or ",(Q". As the saying goes, "garbage in, garbage out".
Notes:
-
If your result is too large, it likely means that you need to account for
the fact that the digits are stored as in ASCII.
-
The digits "000" are valid, as are "999" and everything in between.
-
The program should work for any list of 3 digits.
-
You can assume that there are exactly 3 digits.
- You may need to define other variables in the data
segment to produce the output.
-
Yes, this could be done with a loop, however, you are not required
to use a loop for this.
- You may be asked to meet with your TA to demonstrate your solution.
- Follow the instructions
for the labs and
Homework/Lab Pointers
for turning in your work.
-
Name your source file "hmwkY_XX.asm" and store it in your directory on
the class server (SNOWBALL). Replace "XX" with whatever
corresponds to your account, and
Y should be replaced with the appropriate number.
-
As you are aware certain types of assistance are inappropriate in
this class. Read the collaboration policy given to you at the beginning
of the semester, if you have any questions.
-
What does working with any 3 character sequence
mean when you are supposed to
use last 3 digits of your student ID number?
The input for this assignment is hard-coded, mainly because we have not
covered file input yet. Also, validating input means using
conditional logic,
which we cover soon.
Your solution should be general enough that if we change the
hard-coded digits, it should still work, even if the result does
not make sense, such as a negative result.