32 lines
380 B
NASM
32 lines
380 B
NASM
# Copyright (c) 2024 Freya Murphy
|
|
|
|
# file: fncall.asm
|
|
# test: should return value from function call
|
|
|
|
.text
|
|
.align 2
|
|
.globl main
|
|
|
|
result:
|
|
move $t0, $a0
|
|
move $v0, $t0
|
|
jr $ra
|
|
nop
|
|
|
|
main:
|
|
# save ra on stack
|
|
addi $sp, $sp, -4
|
|
sw $ra, 0($sp)
|
|
|
|
# set return to 17
|
|
li $a0, 17
|
|
jal result
|
|
nop
|
|
|
|
# pop ra from stack
|
|
lw $ra, 0($sp)
|
|
addi $sp, $sp, 4
|
|
|
|
# return result
|
|
jr $ra
|
|
nop
|