Question: Create three procedures that will convert a given value in one of the following temperatures: Celsius Kelvin Newton To Fahrenheit. The procedures should be named

Create three procedures that will convert a given value in one of the following temperatures:
Celsius
Kelvin
Newton
To Fahrenheit.
The procedures should be named
C2F
K2F
N2F
The following equations can be used to convert different temperature types to Fahrenheit :
Kelvin-F =(K -273.15)*1.8000+32
Celsius -F =C *9/5+32
Newton -F =N *60/11+32
You should pass all the values to the procedures using the floating point stack. You should return the converted temperature using the floating point stack. In other words, the converted temperature should be at ST(0)
Once you have the procedures written test them in main by getting a value for each of the three temperatures from the keyboard. Convert the values to the three different temperatures and output them.
Your output should look like the following
Enter a value in C
38.1
In Fahrenheit that value is 100.58
Enter a value in K
45.95
In Fahrenheit that value is -376.96
Enter a value in N
23.98
In Fahrenheit that value is 162.8
Press any key to close this window ...
You may have to use global variables to hold the constants needed for the arithmetic.
Required:
The temperature conversion procedures must be in a separate asm file called conversion.asm. This means you should have main.asm and conversion.asm.You can use constant values in the conversion data segment.asm but you MUST pass the temperature to be converted to the procedure through the floating point stack and return the converted value back to main on the floating points stack.
You can format these as you normally do and paste them one after the other in the submissions box.
NOTE:
The use of legacy directives like DB and DW is not allowed in this class. A deduction of 40%will be given if you use them.
The use of indirect addressing around variables is NOT allowed in the class unless you are using indirect addressing. An example of this would be [val1].Doing this will result in a 25%reduction in your grade.
You are not to use any .IF .ELSE, .WHILE, or .ENDW instructions. You are to use pure old-fashioned assembly language to solve this.
You must comment every line of code you write, or your grade will be reduced 20%
This is an example
INCLUDE asmlib.inc
.data
varC REAL84.1
varB REAL83.1
varA REAL83.1
bad REAL8-1.0
.code
main PROC
fld varC
fld varB
fld varA
; varA at ST(0),varB at ST(1),varC at ST(2)
fcom ; compare ST(0)To ST(1)
fnstsw ax ; copy condtion codes to ax
sahf ; update flags with condition codes
fcmove st(0),st(2); mov st(2)to st(0)if the compare with fcom st(0),st(1)is equal
fadd ST(0),ST(1); add st(0)and st(1)should be 7.2
call writeFloat
exit
main ENDP
END main
It needs to have WriteString, ReadInt, Readline, Writeline, those types and do not use lea and make sure to use BYTE no db please.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!