Question: i have this nios ii assembly code all i have to do is edit it so that it will instead use a subroutine called LARGE.
i have this nios ii assembly code

all i have to do is edit it so that it will instead use a subroutine called LARGE. here is the general main program and just need to fill in the subroutine.

/* Program that finds the largest number in a list of integers .text .global _start start moviar8. RESULT ldw addi ldw subi be addi ldw bge mov br stw r4, 4(r8) r5, r8, 8 r2, (r5) r4, r4, 1 r4, ro, DONE r5, r5, 4 r6, (r5) r2, r6, LOOP r2, r6 LOOP r2, (r8) # r8 points to result location # r4 is a counter, initialize it with N # r5 points to the first number # r2 holds the largest number found so far # decrement the counter # finished if r4 is equal to 0 # increment the list pointer # get the next number # check if larger number found # update the largest number found LOOP DONE: # store the largest number into RESULT STOP: br STOP # remain here when done RESULT:.skip N: NUMBERS: .word 4 # space for the largest number found # number of entries in the list # numbers in the list. . . .word7 4, 5, 3, 6 word 1, 8.2 end /* Program that finds the largest number in a list of integers text global _start start moviar8. RESULT ldw addi call stw r4, 4(r8) r5, r8, 8 LARGE r2, (r8) # r8 points to the result location # r4 holds number of elements in the lis # r5 points to the start of the list # r2 holds the subroutine return value STOP: br STOP LARGE RESULT N: NUMBERS: skip word 7 .word4, 5, 3, 6 word 1,8,2 4 # space for the largest number found # number of entries in the list # the data . . . /* Program that finds the largest number in a list of integers .text .global _start start moviar8. RESULT ldw addi ldw subi be addi ldw bge mov br stw r4, 4(r8) r5, r8, 8 r2, (r5) r4, r4, 1 r4, ro, DONE r5, r5, 4 r6, (r5) r2, r6, LOOP r2, r6 LOOP r2, (r8) # r8 points to result location # r4 is a counter, initialize it with N # r5 points to the first number # r2 holds the largest number found so far # decrement the counter # finished if r4 is equal to 0 # increment the list pointer # get the next number # check if larger number found # update the largest number found LOOP DONE: # store the largest number into RESULT STOP: br STOP # remain here when done RESULT:.skip N: NUMBERS: .word 4 # space for the largest number found # number of entries in the list # numbers in the list. . . .word7 4, 5, 3, 6 word 1, 8.2 end /* Program that finds the largest number in a list of integers text global _start start moviar8. RESULT ldw addi call stw r4, 4(r8) r5, r8, 8 LARGE r2, (r8) # r8 points to the result location # r4 holds number of elements in the lis # r5 points to the start of the list # r2 holds the subroutine return value STOP: br STOP LARGE RESULT N: NUMBERS: skip word 7 .word4, 5, 3, 6 word 1,8,2 4 # space for the largest number found # number of entries in the list # the data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
