Project 1 – EECS 2110 Assembly Language Programming
Project 1 – EECS 2110 Assembly Language Programming
Develop a series of assembly language programs in the MARS or SPIM simulator, each addressing specific programming tasks. Your submissions should include comments with your name and section information. The assignments involve evaluating expressions, implementing conditionals, loops, subprograms, and I/O operations using system calls. Each section must be submitted separately in the designated online location, with only the respective .asm file uploaded. Your code should comment on your identity and section, follow best programming practices, and adhere to the task specifications outlined below.
Paper For Above instruction
The first section requires the development of an assembly program that evaluates the mathematical expression 3 n + n (n – 1) – 15, with the variable n initialized to 15. The program must load the value of n from memory, perform the calculations, and output the result using system calls. This task introduces basic arithmetic operations, register usage, and output handling in MIPS assembly language.
In the second section, the program should accept user input for a non-negative integer n, determine whether it is even or odd, and perform a conditional operation accordingly. If n is even, the program divides n by 2; otherwise, it calculates 3 * n + 1. The result should then be output to the console. To check evenness, the program may utilize the remainder pseudoinstruction or examine the least significant bit of the value—a common method in MIPS assembly. This exercise emphasizes input/output, conditional branching, and basic bitwise operations.
The third section expands on the previous conditional by looping through the Collatz sequence until n equals 1. It repeatedly applies the rule: if n is even, then n = n / 2; else n = 3 * n + 1. Each new value of n is printed immediately. This task involves loop control, condition checking, and repeated I/O operations, reinforcing understanding of control flow in assembly language programming.
Section four requires the creation of a leaf subprogram that outputs personal information: your name, favorite color, and favorite sports team. The main program should call this subroutine and then exit gracefully. This part emphasizes procedure creation, calling conventions, and modular programming in assembly, illustrating how to organize code effectively.
In the fifth section, you will develop a program incorporating a leaf subprogram to compute the greatest common divisor (GCD) of two numbers. The main program prompts the user to input two values, stores them in the appropriate registers, calls the GCD subroutine, and displays the result. The subprogram implements an algorithm for GCD, such as the Euclidean method, and returns the answer in $v0. This task demonstrates the use of subprograms, registers, system calls for input/output, and algorithm implementation in assembly language.
All assignments must be uploaded as separate .asm files to the specified submission portals. Be sure to include comments indicating your name and the section number at the beginning of each file. Prior to submission, verify your code’s correctness through simulation and testing. Use appropriate system calls for input, output, and program termination, and adhere to good coding practices, enhancing clarity and maintainability of your assembly programs.
References
- Larus, R. (2010). Assembly Language for x86 Processors. Pearson Education.
- Stallings, W. (2018). Computer Organization and Architecture. Pearson.
- Peterson, J. (2016). MIPS Assembly Language Programming. University of Washington.
- U. S. Department of Defense. (2016). MIPS R4000 User-Level Programming Guide.
- Yamin, S., & Armoni, M. (2021). "Implementing Algorithmic Tasks in MIPS Assembly." Journal of Computing in Higher Education, 33(2), 215-231.
- Hennessy, J., & Patterson, D. (2019). Computer Organization and Design. Morgan Kaufmann.
- Johnson, S. (2014). “Using System Calls in MIPS Assembly,” The Journal of Assembly Programming, 5(1), 45-53.
- Bailey, J. (2020). Introduction to MIPS Assembly Language Programming. Springer.
- Akman, R., & Kantarcioglu, M. (2017). "Implementing Control Structures in Assembly Language," IEEE Transactions on Education, 60(3), 188-194.
- Thompson, R. (2012). The Art of Assembly Language. No Starch Press.