Starting from:

$30

Assignment #2 Solution

Q1. Write a program to compute the GCD of two (32-bit) integers. You will have to use Euclid's algorithm.




Q2. Implement the sample program given in the attachment. Study all the instructions used and working of the program.




Note: Search the web for “MIPS assembler directives”, and learn how to statically allocate global data using the “.data” and related assembler directives.




Q3. Statically declare some prompt strings for User Input, and redo the addition program to input two integers. Now you must use appropriate strings to prompt the user, and to print the result (sum).




Q4. Define an array of 8 integers declared as static data. Be sure to use the “.align” assembler directive, after understanding what it does (use google). Your main routine should include a loop to read 8 values from the console (using the appropriate syscall) and store it in the 8 array locations. You should use appropriate prompt strings.




Examine what happens without the “.align” directive.

More products