Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 1 : C F and K m / Miles Conversions The purpose of this lab is for you to get familiar with MIPS assembly
Lab : and Miles Conversions
The purpose of this lab is for you to get familiar with MIPS assembly language. In this lab,
you are going to write your first program in assembly.
Please write a program that converts temperature from to and from to In your
program please use only integer instructions mul div, add,... To convert
Celsius larr Fahrenheit, you can use the equations given below.
Your program will get inputsoutputs fromto the console please look at the examples
given in class It is necessary to have system calls in order to use the console.
For this program, you will need to use the following instructions:
mul # multiply to integer numbers
div # divide two integer numbers
After getting the temperature conversion program, you are to modify this program to
have conversion from to Miles and vice versa.
REPORT
Please include the following items in your report.
Explain how your program works. You may use a flow chart, pseudo program, or
other way to explain the program.
Show a couple of examples.
Conclusion section. Explain what you learned here and what was difficult about this
lab.
A print out of your program. # Include comments in your program.
CODE
You are to submit your assembly program ie a text file that can be run with QtSpim
Program "Shell"
text
globl main
main:
la $ conv # print conversion on terminal
$
syscall
$v #yscall reads an integer
syscal
## # if
### then C to F
### else Eto
la saprompc print prompt on terminal
sv
syscall
$v #yscall reads an integer
syscall
## conversion is done here
##
## make sure your result is put in register $to
la saans #print string before result
sv
syscal
move $ # print result that is in register $to
i $
syscall
la $ endl # system call to print
li $ # print a new line
syscall
$v
syscali # exit
data segment
data
conv: asciiz C or :
prompc: asciiz "Enter temperature in Celsius:
ans: asciiz "Temperature in Fahrenheit is:
prompf: asciiz "Enter temperature in Fahrenheit:
ans: asciiz "Temperature in Celsius is:
endl: asciliz
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started