Answered step by step
Verified Expert Solution
Question
1 Approved Answer
.data word Ox44, 22, 33, 55 # array for which we will compute the sum asciiz hWkl .align 2 .word loop, then 1: .text globl
.data word Ox44, 22, 33, 55 # array for which we will compute the sum asciiz "hWkl" .align 2 .word loop, then 1: .text globl main main: la $t0, Ll li $t1, 4 add $t2, $zero, $zero # initialize sum # initialize starting address # initialize loop count loop: lw $t3, O(St0) add St2, St2, St3 addi $t0, $t0, 4 addi St1, St1, -1 bne $ti, $zero, loop # load first element # update sum # point to next word # decrement count # check if done bgt St2, $0, then move $s0, $t2 j exit # if the sum >0, move sum to $s0 # else move sum to $s! then: move $s1, $t2 exit: li Sv0, 10 syscall .data word Ox44, 22, 33, 55 # array for which we will compute the sum asciiz "hWkl" .align 2 .word loop, then 1: .text globl main main: la $t0, Ll li $t1, 4 add $t2, $zero, $zero # initialize sum # initialize starting address # initialize loop count loop: lw $t3, O(St0) add St2, St2, St3 addi $t0, $t0, 4 addi St1, St1, -1 bne $ti, $zero, loop # load first element # update sum # point to next word # decrement count # check if done bgt St2, $0, then move $s0, $t2 j exit # if the sum >0, move sum to $s0 # else move sum to $s! then: move $s1, $t2 exit: li Sv0, 10 syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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