I need help In MIPS asssembly language I have the following
I need help In MIPS asssembly language. I have the following arrarys
Array_X: .word 1,2,4,8,16,64,128,256,512
Array_Y: .word 2,3,5,7,11,13,17,19,23,29
How do I:
1. Take user input of a number (w)
2. Find out if there are 2 items, x_i and x_j in Array_X, such that w = x_i + x_j
3. Find out if there are 2 items, y _i and y_j in Array_Y, such that w = y_i + y_j
IN MIPS ASSEMBLY LANGUAGE!! Please! Thank you so much!
Solution
lw $t3, size
la $t1, list # get array address
li $t2, 0 # set loop counter
print_loop:
beq $t2, $t3, print_loop_end # check for array end
lw $a0, ($t1) # print value at the array pointer
li $v0, 1
syscall addi $t2, $t2, 1 # advance loop counter
addi $t1, $t1, 4 # advance array pointer
j print_loop # repeat the loop
print_loop_end:
