Created
June 28, 2017 10:49
-
-
Save giuscri/d40f9f9af372085192e982a867c9cca5 to your computer and use it in GitHub Desktop.
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
.data | |
type_a_number: .asciiz "*** Type a number (falling back to 0): " | |
type_another_number: .asciiz "*** Type another number (falling back to 0): " | |
numbers_you_typed_are: .asciiz "*** Numbers you typed are: " | |
.text | |
main: | |
li $a0, 8 | |
li $v0, 9 | |
syscall | |
move $s0, $v0 | |
la $a0, type_a_number | |
li $v0, 4 # print string | |
syscall | |
li $v0, 5 # read number | |
syscall | |
sw $v0, 0($s0) | |
la $a0, type_another_number | |
li $v0, 4 # print string | |
syscall | |
li $v0, 5 # read number | |
syscall | |
sw $v0, 4($s0) | |
la $a0, numbers_you_typed_are | |
li $v0, 4 # print string | |
syscall | |
li $v0, 1 # print number | |
lw $a0, 0($s0) | |
syscall | |
li $a0, 0x20 | |
li $v0, 11 # print character | |
syscall | |
li $v0, 1 # print number | |
lw $a0, 4($s0) | |
syscall | |
li $v0, 11 # print character | |
li $a0, 0x0a | |
syscall | |
jr $ra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment