Question: For these programming exercises, use only those instructions that have been discussed so far in these notes: add div mflo slt, slti addi divu mult
For these programming exercises, use only those instructions that have been discussed so far in these notes:
| add | div | mflo | slt, slti |
| addi | divu | mult | sltu, sltiu |
| addiu | j | multu | sra |
| addu | lb | nor | srl |
| and | lbu | or | sub |
| andi | lh | ori | subu |
| beq | lhu | sb | sw |
| bgez | lui | sh | xor |
| bltz | lw | sll | xori |
| bne | mfhi |
USING MARS Simulator
Write a program that stores the number 0 in the first four bytes of the .data section, then stores the number 1 in the next four bytes, then stores the number 2 in the four bytes after that and so on. Do this for numbers 0 through 24.
Of course you will do this in a counting loop. The address in the data section is contained in a base register. Increment the base register each time a number is stored.
The data section of your program should look like
.data array: .space 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
