.globl printFraction
.globl println
.text
#--------------------
printFraction:
# printFraction takes two integers and prints them delimited with a slash
# e.g. 3 8
# print 1st int
# to print int, $v0 = 1,
# we wannt to print the 1st param, so $a0 is NOT need to set
addi $v0, $0, 1
syscall
# print '/'
# to print char, $v0 = 11
# the ascii code for '/' is 47, so set $a0 = 47
addi $v0, $0, 11
addi $a0, $0, 47
syscall
# print 2nd int
addi $v0, $0, 1
add $a0, $0, $a1
syscall
println:
# prints an empty line
# the ascii code for '/n' is 10, so set $a0 = 10
addi $v0, $0, 11
addi $a0, $0, 10
syscall
No comments:
Post a Comment