.data
prompt1: .asciiz "a: "
prompt2: .asciiz "b: "
newline: .asciiz "\n"
.text
main:
# print prompt 1
li $v0, 4
la $a0, prompt1
syscall
# read in $t0
li $v0, 5
syscall
move $t0, $v0
#print prompt 2
li $v0, 4
la $a0, prompt2
syscall
# read in $t1
li $v0, 5
syscall
move $t1, $v0
# $a0 = $t0 + $t1
add $a0, $t0, $t1
# print result
li $v0, 1
syscall
# newline
li $v0, 4
la $a0, newline
syscall
# exit
li $v0, 10
syscall
References:
Maximum score
2 years ago
No comments:
Post a Comment