Question
1. (10 points)Open file 2.1.s by Mars, translate the comments in the file from line 13 to line 17. Save it. Assemble it and Run
1. (10 points)Open file 2.1.s by Mars, translate the comments in the file from line 13 to line 17. Save it. Assemble it and Run it. Submit your modified 2.1.s file in iLearn. (Hint 1: use instruction syscall) (Hint 2, select show line numbers in the Mars as follows)
2. (30 points)Open file 2.2.s by Mars, translate the comments line 31 to line 32. (if-else statement) Save it. Assemble it and Run it. Submit your modified 2.2.file. and Answer the following question: Whats the output of your program?
3. (30 points)Open file 2.3.s by Mars, translate the comments from line 36 to line 44. (if-else statement) Save it. Assemble it and Run it. Submit your modified 2.3.file.
4. Read the slides Chapter_2_04_updatedFile page 51 and page 52 (if-and condition and if-or condition) and answer the following question. For the code: 1) (5 points) Please draw the original flow chart 2) (5 points) Please draw the reversed flow chart 3) (5 points) Please write down the MIPS code if we know x value is in $s0, y value is in $s1 and variable flag is in $s2. For the code: 4)(5 points) Please draw the original flow chart 5)(5 points) Please draw the reversed flow chart 6)(5 points) Please write down the MIPS code if we know x value is in $s0, y value is in $s1 and variable flag is in $s2. 5. (Bonus 10 point) Read the slides Chapter_2_04_updatedFile page 53 (for loop) and answer the following question. For the for loop: for (int i = 0; i
2.3.s) No Selection 1 # 2 # CSc 256 Example 2.3: If-else statement, variables in registers 3 # Name: Jingyi Wang 4 # Date: 9/9/2019 # Description: Demonstrates nested if-else statement 6 # 8 # int main(void) 9 # { # int num, max = 100, flag; 11 # 12 # cin >> num; 14 # 16 17 # # if (num == max) flag = 1; else if (num != 0) flag = -1; else flag = 0; cout > num; addi $s2, $0, 100 addi $v0, $0, 5 # syscall add $80, $v0, $0 # if (num == max) flag = 1; else if (num != 0) # flag = -1; # else flag = 0; cout 2.2.s) No Selection 1# 2 # CSc 256 Example 2.2: If statement, variables in registers 3 # Name: 4 # Date: 2/12/2020 5 # Description: Demonstrates if statement translation 6 # 7 # # #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started