Created
December 4, 2014 05:21
-
-
Save totzyuta/9d45869f6aad82b0e376 to your computer and use it in GitHub Desktop.
print関数を定義するためのアセンブリ言語プログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.align 2 | |
_print_int: | |
subu $sp, $sp, 24 | |
sw $ra, 20($sp) | |
li $v0, 1 # 1: print_int | |
syscall | |
lw $ra, 20($sp) | |
addu $sp, $sp, 24 | |
j $ra | |
_print_string: | |
subu $sp, $sp, 24 | |
sw $ra, 20($sp) | |
li $v0, 4 # 4: print_string | |
syscall | |
lw $ra, 20($sp) | |
addu $sp, $sp, 24 | |
j $ra | |
_read_int: | |
subu $sp, $sp, 24 | |
sw $ra, 20($sp) | |
li $v0, 5 # 5: read_int | |
syscall | |
lw $ra, 20($sp) | |
addu $sp, $sp, 24 | |
j $ra | |
_read_string: | |
subu $sp, $sp, 24 | |
sw $ra, 20($sp) | |
li $v0, 8 # 8: read_string | |
syscall | |
lw $ra, 20($sp) | |
addu $sp, $sp, 24 | |
j $ra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment