w do I change this mips assembly code from Fahrenheit to Celsius to Celsius to Fahrenheit? # mips program  .data      prompt:  .a

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.5: Variables And Declaration Statements
Problem 11E
icon
Related questions
Question
100%

How do I change this mips assembly code from Fahrenheit to Celsius to Celsius to Fahrenheit?

# mips program 
.data
     prompt:  .asciiz "Temperature (F) : "
     message:  .asciiz "Temperature (C) : "
     C: .float 0.0
     F: .float 0.0
     const1: .float 32.0
     const2: .float 5.0
     const3: .float 9.0
.text
 main:
    # printing the message to take input in F
    li $v0, 4
    la $a0, prompt
    syscall
    # getting input from user
    li $v0, 6
    syscall
    
    # loading constant values in registers
    l.s $f1, const1
    l.s $f2, const2
    l.s $f3, const3
    
    # now calculating temperature in C
    sub.s $f0, $f0, $f1
    mul.s $f0, $f0, $f2
    div.s $f0, $f0, $f3   
    
    # printing the converted temperature in C
    li $v0, 4
    la $a0, message
    syscall
    
    li $v0, 2
    mov.s $f12, $f0
    syscall

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr