Question
You need to upload only the .asm (assembly language) file
Solve Section 4 only
Section 1: Using the MARS or SPIM simulator develop a program that will evaluate the following expression 3 n n* (n 1) 15 where n is stored in a data location and is set to 15. Your program should use the system calls to print the result and to exit the program. Section 2: Using the MARS or SPIM simulator develop a program that will implement the following conditional statement. If n is even) n /2 else n 3 n 1; In this case, n is to be input by the user (assume they input a non-negative value), the conditional is performed, and the resulting n is to be output. Again, use the system calls for input, output, and exiting the program Hint: There is a remainder pseudoinstruction for the MIPS architecture that you can use to determine if the value is even or odd or you can look at bit o to determine if the value is even or odd.
Explanation / Answer
Here the assembly program looks like
main:
instruction 1
instruction 2
instruction 3
instruction 4
bl display (Call display function from main function)
display:
msg db 'Your Name', 0xa ;string to be printed
msg db 'Your Favourate Color', 0xa ;string to be printed
msg db 'Your Favourate Sports team', 0xa ;string to be printed