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
CF
KF
NF
The following equations can be used to convert different temperature types to Fahrenheit :
KelvinF K
Celsius F C
Newton F N
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
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
In Fahrenheit that value is
Enter a value in K
In Fahrenheit that value is
Enter a value in N
In Fahrenheit that value is
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 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 valDoing this will result in a reduction in your grade.
You are not to use any IF ELSE, WHILE, or ENDW instructions. You are to use pure oldfashioned assembly language to solve this.
You must comment every line of code you write, or your grade will be reduced
This is an example
INCLUDE asmlib.inc
data
varC REAL
varB REAL
varA REAL
bad REAL
code
main PROC
fld varC
fld varB
fld varA
; varA at STvarB at STvarC at ST
fcom ; compare STTo ST
fnstsw ax ; copy condtion codes to ax
sahf ; update flags with condition codes
fcmove stst; mov stto stif the compare with fcom ststis equal
fadd STST; add stand stshould be
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
