Skip to content

Instantly share code, notes, and snippets.

@giuscri
Created June 28, 2017 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuscri/d40f9f9af372085192e982a867c9cca5 to your computer and use it in GitHub Desktop.
Save giuscri/d40f9f9af372085192e982a867c9cca5 to your computer and use it in GitHub Desktop.
.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