Question: I need the MIPS code filled out #Precondtions: # 1st parameter (a0) address of head node # Postconditions: # Every other node is removed from

I need the MIPS code filled out

#Precondtions: # 1st parameter (a0) address of head node # Postconditions: # Every other node is removed from the list and deleted.

select: addi $sp, $sp, -8 # make space on stack sw $s0, 0($sp) # preserve registers used by this function sw $ra, 4($sp) # preserve return address

move $s0, $a0 # s0 = p = list

while: # while (p != NULL) # t0 = p->next # if (p->next != NULL) # t1 = p->next->next # p->next = p->next->next

# 1st parameter = p->next # 2nd parameter = size of node # delete node

endif: # p = p->next # jump to beginning of loop

return: lw $s0, 0($sp) # restore registers used by this function lw $ra, 4($sp) # restore return address addi $sp, $sp, 8 # restore stack pointer jr $ra # return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!