IUP Computer Science
COSC 300
Exercise #2
(28 February 2008)
Write an assembly language program that prompts the person at the
keyboard five times for integer values and displays the sum of the five
numbers. The text of the display should state what the result is.
Essentially, this is a task of rewriting the following C++ function in assembly language.
int main ()
{
int sum = 0;
int value;
int count;
for (count = 0; count < 5; count++)
{
cout << "Enter an integer value: ";
cin >> value;
sum += value;
}
cout << "The sum of the values is " << sum << endl;
return 0;
}
There is one
additional task for your program. After displaying the sum, display the
contents of all of the registers.
You are allowed to work on this exercise with one other student as your partner;
or you may work alone. Name the
assembly language (.asm) file after yourself or after the two of you if you have
a partner. Do NOT name the file
exercise2.asm. When you are finished, copy the
.lst to
the Z: drive. Copy the .lst file
to
Z:\jlwolfe\cosc300\ex2