These are several MIPS assembly language programs that I made for my Computer Organization and Architecture course. Feel free to use them however you like.
The tic-tac-toe program evaluates a list of winning conditions to determine the winner between two players. It checks for diagonal as well as vertical wins. If no player wins, then the program will consider the game a draw.
Figure 1: The tic-tac-toe program features a console UI that will allow players to select a number to indicate their movement.
Figure 2: After the game ends, the program will display the winner or state that it was a tie.
This is a two player game that compares player 1's choice to player 2's choice and determines the winner. It works by checking whether the first player used rock, paper, or scissors and then determining the win outcome based on player 2's response.
Figure 3: Players can choose between rock, paper, or scissors and the program will evaluate the result afterwards.
This program computes the Fibonacci sequence sum from a user-provided number. However, numbers that are above a certain threshold result in an arithmetic overflow error due to the limitations of the program and the MIPS architecture.
Example Result
Enter a number to compute the Fibonacci: 20
6765
This program calculates the maximum number along with the average in a list. List elements are provided in the script and a loop is used to iterate through the list.
Program Input
.data
list: .word 3, 6, 23, 6, 92, 2, 2, 5, 12, 76
size: .word 10
(...)
Program Output
The max number of the list is: 92
The average of the list is: 22
You can run these programs by using the free MARS MIPS Simulator found on the Missouri State University website here.
Program Execution
- After opening the software, navigate to
File -> Open ...
and then select the.asm
file downloaded from this repository. - Click
Run -> Assemble
to compile the program. - Press the green "Play" button. Alternatively, you can use
Run -> Go
or the F5 function key.
Notice The simulator requires the Java Runtime Environment to run, so make sure that you have that installed.