SPIM code for floating point operations

# this program evaluates 3.1428 + 2.7182 + 17
# the numbers are not meaningful out here but are approximations to 
# pi, e and 17 is a prime number

	.data
pi:	.float 3.1428

	.text
main:
	li.s  	$f2, 2.7182	# load immediate e(2.7182) into floating reg. f2
	l.s   	$f4, pi		# note, even numbered floating reg. used
	add.s 	$f2, $f2, $f4	# add pi and e. Result in f2
	li    	$t0, 17		# load 17 into a CPU reg.
	mtc1  	$t0, $f6	# move 17 to f4
	cvt.s.w $f4, $f6	# convert 17 to a floating number, result in f4
	add.s   $f2, $f4, $f2	# add 17.0 to pi + e
	
	li   	$v0, 2		# system call for print_float
	mov.s	$f12,$f2	# notice the two stepped move from f2 to f12
	syscall			

	
	li   	$v0, 4		# system call for print_str
	la   	$a0, newline	# address of str to print
	syscall			

	jr     $ra		# return
	
	.data
newline:.asciiz "\n"