Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
--- /dev/null
+.text
+main:
+ li $a0, 5
+ li $a1, 10
+ addi $sp, $sp, -12
+
+ sw $a0, 4($sp)
+ sw $a1, 0($sp)
+ jal opMult
+
+ lw $v0, 0($sp)
+ addi $sp, $sp, 4
+
+ move $a0, $v0
+ li $v0, 1
+ syscall
+ li $v0, 10
+ syscall
+
+opMult:
+ addi $sp, $sp, -40
+ sw $fp, 36($sp)
+ sw $ra, 32($sp)
+ sw $s0, 28($sp)
+ sw $s1, 24($sp)
+ sw $s2, 20($sp)
+ sw $s3, 16($sp)
+ sw $s4, 12($sp)
+ sw $s5, 8($sp)
+ sw $s6, 4($sp)
+ sw $s7, 0($sp)
+ addi $fp, $sp, 36
+
+ lw $t1, 8($fp)
+ lw $t2, 4($fp)
+ mul $t1, $t1, $t2
+ sw $t1, 12($fp)
+
+ lw $s7, 0($sp)
+ lw $s6, 4($sp)
+ lw $s5, 8($sp)
+ lw $s4, 12($sp)
+ lw $s3, 16($sp)
+ lw $s2, 20($sp)
+ lw $s1, 24($sp)
+ lw $s0, 28($sp)
+ lw $ra, 32($sp)
+ lw $fp, 36($sp)
+ addi $sp, $sp, 48
+ jr $ra
+