Question: 1. In MIPS, when you load a byte from memory into a register: - What happens to its value? (There are two options.) - Why

1. In MIPS, when you load a byte from memory into a register:

- What happens to its value? (There are two options.)

- Why do we do this?

This class focuses mainly using MIPS

1. When we call functions, often those functions push registers on the stack and pop them off before they return. Why? (What bad things would happen if they didn't do that?)

2. For the following situations, write what kind of register you would use (a, v, t, s) and why.

x + 1 in the code check_block(x + 1, y).

i in the code for(i = 0; i < 10; i++) { ... }.

row * WIDTH in the code block_arr + row * WIDTH + col.

block_arr + row * WIDTH + col in the code return block_arr + row * WIDTH + col.

The address of my_var in the code my_var = their_var, where my_var is in memory!

Look at the following snippets of code. For each, write some C/Java-like pseudocode to show what the code does.

a.

 la t0, ball_x lw t1, (t0) addi t1, t1, 1 sw t1, (t0) 

b.

 li s2, 0 top: move a0, s2 li v0, 1 # "print int" syscall syscall addi s2, s2, 1 blt s2, 10, top 

c.

 add a0, t0, t1 add a1, t2, t3 li a2, COLOR_WHITE jal Display_SetLED 

d.

 lw t0, ball_x ble t0, 2, flip_x blt t0, 61, update_x flip_x: lw t1, ball_vx neg t1, t1 sw t1, ball_vx update_x: lw t1, ball_vx add t0, t0, t1 sw t0, ball_x 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!