Question: Using mips assembly, In this assignment, I need to display the running sum (total located on the right side of chart) of a fixed amount
Using mips assembly, In this assignment, I need to display the running sum (total located on the right side of chart) of a fixed amount of 20 first fibo numbers. I got the fibo numbers running but need the running sum(total) (on the right side of the chart)..
WARNING: PLEASE DON'T answer this question if the code is not WORKING AND don't just copy and paste my code like how some chegg expert did and submit it as ANSWER....

# Compute several Fibonacci numbers and put in array, then print .data fibs: .word 0 : 20 # "array" of words to contain fib values size: .word 20 # size of "array" ##prompt: .asciiz "How many fibonacci numbers to generate ? (2
.data space:.asciiz " " # space to insert between numbers cr: .asciiz " " head: .asciiz "The Fibonacci numbers are: " number: .asciiz "Number" total:.asciiz "Total"
.text print:add $t0, $zero, $a0 # starting address of array add $t1, $zero, $a1 # initialize loop counter to array size la $a0, head # load address of print heading li $v0, 4 # specify Print String service syscall # print heading out: lw $a0, 0($t0) # load fibonacci number for syscall li $v0, 1 # specify Print Integer service syscall # print fibonacci number la $a0, space # load address of spacer for syscall li $v0, 4 # specify Print String service syscall # output string addi $t0, $t0, 4 # increment address addi $t1, $t1, -1 # decrement loop counter bgtz $t1, out # repeat if not finished jr $ra # return
For example, the output of the program should have first 5 numbers in the series. Fibonacci series Number total 1 2 12 6765
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
