Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code : .data n: .word 13 .text main: add $t0, $0, $zero addi $t1, $zero, 1 la $t3, n lw $t3, 0($t3) fib: beq $t3,
code : .data
n: .word 13
.text
main: add $t0, $0, $zero
addi $t1, $zero, 1
la $t3, n
lw $t3, 0($t3)
fib: beq $t3, $0, finish
add $t2,$t1,$t0
move $t0, $t1
move $t1, $t2
subi $t3, $t3, 1
j fib
finish: addi $a0, $t0, 0
li $v0, 1 # you will be asked about what the purpose of this line for syscall
syscall
li $v0, 10
syscall
Load fib s into MARS and assemble the code. Note that Fibonacci number calculation is as follows: fib[1] 1 Q1. What do the data, word, .text directives mean (i.e., what do you put in each section)? Q2. How do you set a breakpoint in MARS? Set breakpoint on line 15, give the command in your answer. Q3. After your program stops because of a breakpoint, how do you continue to execute your code? How do you step through your code? Q4. How can you find out the contents of a register? How do you modify the value of a register? Q5. At what address is n stored in memory? Calculate the 13th fib number by modifying this memory location Q6. ine 18 and 20 use syscall instruction. What is it and how do you use it
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