Search binary mips

3

I am developing a code in mips in order to perform a binary search recursively, well along the development some doubts appeared, being:

  • Soon after my function call, I unpair my arguments, but should I also unstack my $ ra? Performing as below:

    lw $s0, 0($sp)  # desempilha o valor a ser buscado
    lw $s1, 0($sp)  # desempilha valor Ult
    lw $s2, 0($sp)  # desempilha valor Pri
    lw $s3, 0($sp)  # desempilha ref vetor A
    lw $ra, 0($sp)  # desempilha o $ra
    
  • And at the end when I'm going to make the recursive call, I need to stack all my arguments, right? Besides my $ ra? By the way, is he going to control me so I do not get lost in recursion calls?

  • If anyone can, I'd like a simple example.

    Note: I know that passing arguments should not be done using mips' convention stacks, but this work requires this.

        
    asked by anonymous 24.10.2015 / 05:13

    0 answers