Project

Part 1
Write a MIPS assembly language subroutine called PrintName that displays your username to
the console in SPIM. Use the syscalls discussed in class and in Appendix A of the textbook to
accomplish this. Your program should be named project_1_part_1.s. Submit ONLY the
subroutine, using the template found on the Projects page of the course website. Your
subroutine will be graded by making multiple subroutine calls (using jal PrintName) to
PrintName to ensure that it works repeatedly.

Part 2
Write a MIPS assembly language subroutine called GetCode that asks the user to enter a 7 bit
code consisting of ones and zeros. When the user is finished entering the data, they should hit
the Enter key. The data should be stored in memory as a NULL terminated ASCII string at the
address passed into the routine in register a1. The user should be prompted for the data by
displaying a prompt to the console asking them to enter the data. These prompts can be stored in
the beginning of the data segment, and should not reside outside of the range 0x10000000
through 0x1000FFFF in memory. Use the syscalls discussed in class and in Appendix A of the
textbook to implement this subroutine. Your program should be named project_1_part_2.s.
Submit ONLY the subroutine, using the template found on the Projects page of the course
website. Your subroutine will be graded by making multiple subroutine calls (using jal
GetCode) to GetCode to ensure that it works repeatedly.

Part 3
Write a MIPS assembly language subroutine called GetOnes that accepts a pointer to a NULL
terminated ASCII string in register a1. The routine should count the number of ones (ASCII
value 0x31) in the string, and return that number is register v0. The string should not be
modified by your routine. Your program should be named project_1_part_3.s. Submit ONLY
the subroutine, using the template found on the Projects page of the course website. Your
subroutine will be graded by making multiple subroutine calls (using jal GetOnes) to GetOnes to
ensure that it works repeatedly.

Part 4
Write a MIPS assembly language program that tests Parts 2 and 3. The program should allow
the user to repeatedly enter a code (calling GetCode) and obtain the number of ones in the code
(calling GetOnes). When the number of ones are obtained, that result should be displayed on the
screen. The program should end when the user decides to quit. Your program should be named
project_1_part_4.s.

Leave a Reply

Your email address will not be published. Required fields are marked *