# ############################################################### # # Program_03_sample_02.asm # # # # Test program for floating-point fundamentals # # # # This is a PC-SPIM sample program for MIPS instructions for # # handling fraction numbers. # # ############################################################### # .data NUM_01: .float 100.5 # first fraction number NUM_02: .float 100.7 # second fraction number MSG_01: .asciiz "The first fraction number is larger than the second one" MSG_02: .asciiz "The second fraction number is larger than the first one" .text .globl main main: la $a0, NUM_01 # load the first fraction contsnat lwc1 $f10, ($a0) # load it to $f10 register la $a0, NUM_02 # load the second fraction contsnat lwc1 $f11, ($a0) # load it to $f10 register add.s $f1, $f10, $f11 # add first number to the second number li $v0, 2 # system call #2 - print a floating- # point fraction number mov.s $f12, $f1 # copy $f1 to $f12 ($f1 -> $f12) syscall # do it! jr $31 # stop the program