diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-30 18:50:22 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-30 18:50:22 -0400 |
commit | c250afa7a0a9fe003196aded1a0749ed440481a3 (patch) | |
tree | 25fde1682fbc50055d70869802a2822c404749a7 /test/masm/fncall.asm | |
parent | update tests (diff) | |
download | mips-c250afa7a0a9fe003196aded1a0749ed440481a3.tar.gz mips-c250afa7a0a9fe003196aded1a0749ed440481a3.tar.bz2 mips-c250afa7a0a9fe003196aded1a0749ed440481a3.zip |
update testing
Diffstat (limited to 'test/masm/fncall.asm')
-rw-r--r-- | test/masm/fncall.asm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/masm/fncall.asm b/test/masm/fncall.asm new file mode 100644 index 0000000..96d1ba2 --- /dev/null +++ b/test/masm/fncall.asm @@ -0,0 +1,29 @@ +# 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 + +main: + # save ra on stack + addi $sp, $sp, -4 + sw $ra, 0($sp) + + # set return to 17 + li $a0, 17 + jal result + + # pop ra from stack + lw $ra, 0($sp) + addi $sp, $sp, 4 + + # return result + jr $ra |