Lab 3 MIPS

Minimum Submission Requirements

  • Ensure that your Lab3 folder contains the following files (note the capitalization convention):

○ Lab3.asm

○ README.txt

  • Commit and push your repository

Lab Objective

This lab will introduce you to the MIPS ISA using MARS. You will write a program that calculates the factorial of an integer between 0 and 10.

Lab Preparation

Read chapters 1 (section 1.3), 2, 3, and 7 from Introduction To MIPS Assemblym Language Programming. In addition, watch videos 2-3 and 19 from this video playlist:


You will write a program in the MIPS32 language using the MARS integrated development environment to calculate the factorial of a number.

Example Outputs

Enter an integer between 0 and 10: 11

Invalid entry!

Enter an integer between 0 and 10: 0

0! = 1

-- program is finished running --

Enter an integer between 0 and 10: 10

10! = 3628800

-- program is finished running --

For full credit, the output should match this format exactly . Take note of the:

  1. Exact wording of the prompts
  2. Space after each colon
  3. Space before and after the equal sign
  4. New line character after the prompt
  5. New line character after the error message
  6. New line character after the final result


This program will prompt the user for an integer between 0 and 10 and calculate the factorial. If the user enters a number outside of the acceptable range, the program must notify the user, and prompt the them again for an integer. You may assume that the grading script will only provide decimal integer inputs that can be stored in 32 bits.

The ASCII values for the characters you will be printing are here:









Table: ASCII Codes


You must use the following syscalls for their specified purposes as shown below:





Print integer

Print integers


Print string

Print prompt and error message


Read integer

Read user input



Exit your program cleanly


Print character

Print exclamation point, spaces, and equal sign in answer printout

Table: Required Syscalls


Note that part of our grading script is automated, so it is imperative that your program’s output matches the specification exactly. Output that deviates from the spec will cause point deduction.

Your code should end cleanly without error. Make sure to use the exit syscall (syscall 10).



This file contains your code.

Follow the code documentation guidelines Make sure to include a header comment and pseudocode.


This file must be a plain text (.txt) file. For full credit, it should contain your first and last name (as it appears on Canvas) and your CruzID. Your answers to the questions should total at least 150 words. Your README should adhere to the following template: