Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a SPIM assembly language program convertF2C.s. The program will do the fol

ID: 3733417 • Letter: W

Question

Write a SPIM assembly language program convertF2C.s. The program will do the following: Prompt the user to enter a temperature in Fahrenheit Convert it to Celsius Print out the converted values of the input 100, 0, and 50 with appropriate message Program#2: Write a SPIM assembly language program equation.s based on the example program math1.s in the lab notes. The program will do the following: Prompt the user to enter a value for x Calculate the result Print out the calculated results of the input 7, 5, and 9 with appropriate message

Explanation / Answer

##
## Program Name: convertF2C.s
##
## - will convert the value of entered fahrenheit temperature to celcius
## -
## -
##
##
## t4 - holds the result of the calculation
## a0 - points to output strings
##

#################################################
# #
# text segment #
# #
#################################################

.text
.globl __start
__start: # execution starts here

la $a0,enterF # print prompt string
li $v0,4
syscall
  
li $v0,5 # read the integer using syscall
syscall
sw $v0,F # store the read integer from $v0 to X
  
lw $t0,F
subi $t0,$t0,32
li $t4,5
mul $t4,$t0,$t4 # t4 = (F-32)*5
li $t1,9
divu $t4,$t4,$t1 # t4 = ((F-32)*5)/9
  
la $a0,ans1 # print string before result
li $v0,4
syscall

move $a0,$t4 # print result
li $v0,1
syscall

la $a0,endl # syscal to print out
li $v0,4 # a new line
syscall

li $v0,10 # Exit
syscall # Bye!


#################################################
# #
# data segment #
# #
#################################################

.data
F: .word 100
  
ans1: .asciiz "Answer = "
endl: .asciiz " "   
  
enterF: .asciiz "Enter the temperature in Fahrenheit: "
  
##
## end of file convertF2C.s

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote