S0 contains the value of end s1 contains the address

This preview shows page 1 out of 1 page.

21.$s0 contains the value of end, $s1 contains the address of the array numbers, and $s2 contains the value of i.la $s1, numbers #contains the address of the array numbersint numbers[7] = {2,1,3,4,6,5,7};
22.To jump from method to method Main: addi $sp, $sp, -4# move the stack pionter down sw $ra, 0($sp)# save the return adress for mainjal method1 #jump and link to method1#returns here after method1 endslw $ra, 0($sp)# copy return Address for main backaddi $sp, $sp, 4# move the stack pointer upjr $ra # return exit programmethod1: # do what you need to do herejr $ra # return to main23.To go from a positive to a negative (+10) to (-10):We invert (+10) 0000 1010: 1111 0101Then we add 1: 1111 0110 = (-10)To go from a negative to a positive (-10) to (+10):we sub 1 to (-10) 1111 0110: 1111 0101then we invert 1111 0101: 0000 1010

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture