Part L: Assembly Language, part 3 (24 marks)
For this question, three text files called q12a.asm, q12b.asm and q12c.asm have been provided for you to fill in your answers. You must provide code that completes each of the functions below:
N! is short for “N factorial”.
a) Inq12a.asm,assumethat$a0containsanunsignedintegerN.CalculateN!andstore the result in $v0. (assume that the length of N! will be less than 32 bits). (8 marks)
Copyright By cscodehelp代写 加微信 cscodehelp
b) Inq12b.asm,assumethat$a0and$a1containtwopositiveintegers.Calculatethe largest integer that can divide both $a0 and $a1 evenly (the greatest common divisor) and store that value in $v0. (8 marks)
c) In q12c.asm, assume that $a0 and $a1 contain two pixel values from the bitmap display of your final project. Set $v0 to store the pixel value that is the average of $a0 and $a1 (meaning that each colour component of $v0 is the average of the corresponding colour components in $a0 and $a1). (8 marks)
When completing this question, make sure that you do the following:
Comment your code to help us understand each of your steps.
Make sure your code assembles and runs before you submit it!
We will be using testing scripts to check the functionality of your code. Keep the following guidelines in mind before you submit your solution:
Only add your code to the end of the files provided, after the comment that says, “ONLY ALTER THE CODE BELOW THIS LINE”. Anything above this comment will be replaced with our own testing code.
Save and submit your .asm files as plain text (do not save it in Word or a PDF or any other file format that could interfere with our testing scripts).
Do not implement your solutions recursively.
Once your code is complete, do not use jr $ra or syscall commands to terminate
your program. This will cause our testing scripts to fail.
Student Number: __________________ 16 (continued)
程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: firstname.lastname@example.org