default.txt 487 B

12345678910111213141516171819202122
  1. .text
  2. .global AckermannFunc
  3. # Preconditions:
  4. # 1st parameter ($a0) m
  5. # 2nd parameter ($a1) n
  6. # Postconditions:
  7. # result in ($v0) = value of A(m,n)
  8. AckermannFunc:
  9. addi $sp, $sp, -8
  10. sw $s0, 4($sp)
  11. sw $ra, 0($sp)
  12. # move the parameter registers to temporary - no, only when nec.
  13. LABEL_IF: bne $a0, $zero, LABEL_ELSE_IF
  14. addi $v0, $a1, 1
  15. # jump to LABEL_DONE
  16. j LABEL_DONE