CSE 2312 - Assignments - Assignment 8

The assignment will be graded out of 100 points. Submit your source code for each task, in files called task1.s, task2.s, and so on. Submit your solutions to Blackboard before the deadline. You will be able to revise your answers until the deadline with no penalty.

IMPORTANT: By submitting your answers, you are certifying that you have followed the UTA standards of academic integrity, and that these answers have been exclusively your own work. All students enrolled in this course are expected to adhere to the UT Arlington Honor Code:

I pledge, on my honor, to uphold UT Arlington's tradition of academic integrity, a tradition that values hard work and honest effort in the pursuit of academic excellence. I promise that I will submit only work that I personally create or contribute to group collaborations, and I will appropriately reference any work from other sources. I will follow the highest standards of integrity and uphold the spirit of the Honor Code.


Task 1 (10 points)

Write an assembly program that prints out the character for each ASCII code from 80 up to (and including) 100. Each character should be on its own line. For example, the first few lines of your output should look like this:

P
Q
R
S
T
and so on.


Task 2 (20 points)

Consider the following code in C:
int i;
for (i = 20; i <= 30; i++)
{
  if (i == 24) printf("24\n");
  else if (i == 27) printf("27\n");
  else printf("z\n");
}
Write an assembly program that:


Task 3 (10 points)

Write an assembly program that prints out all multiples of 7 between 0 (including zero) and 100. Each number should be printed in hexadecimal, on a separate line. For example, the first few lines of your output should look like this:
0
7
E
15
1C
and so on.


Task 4 (20 points)

Write an assembly program that prints out all multiples of 345 between 0 (including zero) and 3000. Each number should be printed in hexadecimal, on a separate line. For example, the first few lines of your output should look like this:
0
159
2B2
40B
564
and so on.


Task 5 (40 points)

Write assembly code (NOT a complete program) that: assuming that r1 holds a value between -299 and 299, prints out that value in decimal. If r1 holds a value less than -299, your program should print "< -299". If r1 holds a value greater than 299, your program should print "> 299". For example, when your code is placed at the indicated position, the program below should print 17.
.globl _start
_start:
        mov r1, #17

        @@@ Place your code here.

Your program should print out a minus sign at the beginning of the number, if the number is between -299 and -1.

Obviously, to test your code you will need to write a complete program. However, you should submit a file task5.s that includes ONLY the portion of the code that this task explicitly requests you to write.


Back to the list of assignments.