0

completely new to MIPS and Assembly. Trying to make a simple program that reads a float and outputs it. Having a bit of trouble:

           .data
msg2: .asciiz "please enter a value: "

    .text
    .globl main
main: 
    li $v0, 4                         #load value for print_string
    la $a0, msg2                   #load address of msg2 into $a0
    syscall                           #print msg2 to screen

    li $v0, 6                         #load value for read_float
    mov.s $f1, $f0
    syscall                           #read inputted value


    li $v0, 2           
    syscall     
    jr $ra

I'll input my float in SPIM and it spits back out 0.00000000. This seems like it should be simpler. I've been searching for help regarding MIPS and floats/doubles but I can't find much. Any help would be greatly appreciated

1 Answers1

0

The read_float call (syscall 6) puts its result in $f0.

The print_float call (syscall 2) expects its argument to be in $f12.

You'll need something to move the value to the appropriate location.