# Add Some floats # # read num1 and num2 from keyboard # print (on screen) the sum of the numbers read # # f0: num1 and num2 # f4: sum # .data prompt: .asciiz "\n Enter a number: " result: .asciiz "The sum of your numbers is " .globl main .text main: sub.s $f4, $f4, $f4 # $f4 is sum, sum = 0 # read and add first num li $v0, 4 # system call code for print string la $a0, prompt # load addr of prompt in $a0 syscall # print prompt li $v0, 6 # system call code for read float syscall # read num1 into $f0 add.s $f4, $f4, $f0 # add num1 to sum # read and add second num li $v0, 4 # system call code for print string la $a0, prompt # load addr of prompt in $a0 syscall # print prompt li $v0, 6 # system call code for read float syscall # read num2 into $f0 add.s $f4, $f4, $f0 # add num2 to sum # print the sum li $v0, 4 # system call code for print str la $a0, result # load addr of result msg in $a0 syscall # print result msg li $v0, 2 # system call code for print float mov.s $f12,$f4 # copy sum into $f12 syscall # print sum # exit from program li $v0, 10 # terminate execution and syscall # return control to system