Question

I'm new to MIPS. How to write a program that prompts the user for a temperature...

I'm new to MIPS. How to write a program that prompts the user for a temperature in Celsius and then display the result in Fahrenheit.

Have to use ineteger to float conversion.

Homework Answers

Answer #1

//initialize the variables

.data
inputcel: .asciiz "Celcius "
outputfahren: .asciiz "Fahrenheit: "
value1: .float 32.0
value2: .float 5.0
value3: .float 9.0

//read input value to v0 register through accumulator

.text
li $v0, 4
la $a0, inputcel
syscall

li $v0, 6
syscall

//move the values for the calculation to registers

l.s $f1, value1
l.s $f2, value2
l.s $f3, value3

//do the calculations


mul.s $f0, $f0, $f3
div.s $f0, $f0, $f2

add $f0, $f0, $f1

//store the output to v0 register using accumulator

li $v0, 4
la $a0, outputfahren
syscall

li $v0, 2
mov.s $f12, $f0
syscall

//print the value of fahrenheit

li $v0, 10
syscall

This code will convert the temperature in celcius to fahrenheit in floating points.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a java program that repeatedly prompts the user to input a string starting with letters...
Write a java program that repeatedly prompts the user to input a string starting with letters from the English alphabet. The program must stop getting input when the user inputs the string “STOOOOP”. Then the program must display the words starting with each letter from the alphabet in a separate line (e.g. you need to make a new line after all words starting with a specific letter are finished.
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.
(Python Programming) Write a program that prompts a user for a positive integer and then uses...
(Python Programming) Write a program that prompts a user for a positive integer and then uses a loop to calculate and display the sum of specific fractions as follows: Let's say the user enters 5, then your program will compute: 1/5 + 2/4 + 3/3 + 4/2 + 5/1 which is 8.7.
step by step in python please The program will prompt the user as to whether you...
step by step in python please The program will prompt the user as to whether you want to convert from Celsius to Fahrenheit or from Fahrenheit to Celsius Write it so each conversion is contained within its own function (i.e., one function to do the math in one direction, a second to do the math in the other direction) These two functions should just have the input temperature as a parameter and return the output temperature in the other units....
Program must be in JAVA. Write a program that converts temperature from Celsius to Fahrenheit or...
Program must be in JAVA. Write a program that converts temperature from Celsius to Fahrenheit or vice versa, depending on user's input. The formula for converting temperature in Celsius to Fahrenheit is, Fahrenheit = (9/5) * Celsius + 32 The formula for converting temperature in Fahrenheit to Celsius is, Celsius = (5/9) * (Fahrenheit – 32) Results should be rounded to two decimal points, e.g., 92.56
Write a program that prompts the user to enter a string and displays the number of...
Write a program that prompts the user to enter a string and displays the number of characters it contains, fourth character, and last character. Note: The string may contain blanks. For example: “C++ programming is fun”. You should write a complete program.
write a MIPS assembly program to get an integer input from the user and multiply it...
write a MIPS assembly program to get an integer input from the user and multiply it by 2 and print output to the console
Write a program that prompts the user for a measurement in meters and then converts it...
Write a program that prompts the user for a measurement in meters and then converts it to miles, feet, and inches. Again, check for valid input and exit with an error msg if you don’t get it. Testing: use some known values here and watch for integer truncation. This should be in javascript and should execute in netbeans.
Write a program that prompts the user for a number from 1 to 200 until 113...
Write a program that prompts the user for a number from 1 to 200 until 113 is encountered. Not including the 113, calculate the average. Do this in python. DO NOT USE LISTS!
Write a complete program that prompts the user to enter the number of students and each...
Write a complete program that prompts the user to enter the number of students and each student’s score, then finally displays the highest score.(in C++)