NASM PROGRAM FOLLOWING THE CODE BELOW, modify it Write an assembly program for the family propcessor x86 in order to transform a temperature from the Celsius scale to the Fahrenheit scale according the transformation below;                   F=1.8*C +32   Use arithmetic of real numbers for the evaluation of the formula and get the result with two digit of precision in the decimal part. Insert the input by using the keyboard and show the output on the console. section .text global main extern printf extern scanf section .data message: db "The temperture in Fahrenheits: %d.", 0 msg2: db "%d", 10, 0 request: db "Enter a temperature in Celsius: ", 0 celsius: times 4 db 0 ; 32-bits integer = 4 bytes reminder: times 4 db 0 formatin: db "%d", 0 main: ; Ask for an integer push request call printf add esp, 4 ; remove the parameter push celsius ; address of integer1, where the input is going to be stored (second parameter) push formatin ; arguments are right to left (first parameter) call scanf add esp, 8 ; remove the parameters ; Move temperature in Celsius under the address integer1 to EAX mov eax, [celsius] call c2f ; jump to function to Transform temperature C2F ; Print out the content of eax register with the temperature in Fahremheits push eax push message call printf add esp, 8 ; Get fractional part. We use the relationship d1=2*r mov eax, [reminder] imul eax, 2 ;mov ebx, 2 ;imul ebx; ; Syntax imul r/m32 ; Print fractional part push eax push msg2 call printf add esp, 8 ; Linux terminate the app mov al, 1 mov ebx, 0 int 80h ; Transform temperature C2F c2f: mov edx, 0 imul eax,9 add eax,160 mov ebx, 5 idiv ebx mov [reminder], edx ret

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.6: Nested Loops
Problem 4E
icon
Related questions
Topic Video
Question
NASM PROGRAM FOLLOWING THE CODE BELOW,
modify it
Write an assembly program for the family propcessor x86 in order to transform a temperature from the Celsius scale to the Fahrenheit scale according the transformation below;
                  F=1.8*C +32
 
Use arithmetic of real numbers for the evaluation of the formula and get the result with two digit of precision in the decimal part. Insert the input by using the keyboard and show the output on the console.

section .text
global main
extern printf
extern scanf

section .data
message: db "The temperture in Fahrenheits: %d.", 0
msg2: db "%d", 10, 0
request: db "Enter a temperature in Celsius: ", 0
celsius: times 4 db 0 ; 32-bits integer = 4 bytes
reminder: times 4 db 0

formatin: db "%d", 0

main:
; Ask for an integer
push request
call printf
add esp, 4 ; remove the parameter

push celsius ; address of integer1, where the input is going to be stored (second parameter)
push formatin ; arguments are right to left (first parameter)
call scanf
add esp, 8 ; remove the parameters


; Move temperature in Celsius under the address integer1 to EAX
mov eax, [celsius]
call c2f ; jump to function to Transform temperature C2F

; Print out the content of eax register with the temperature in Fahremheits
push eax
push message
call printf
add esp, 8


; Get fractional part. We use the relationship d1=2*r
mov eax, [reminder]
imul eax, 2
;mov ebx, 2
;imul ebx; ; Syntax imul r/m32

; Print fractional part
push eax
push msg2
call printf
add esp, 8

; Linux terminate the app
mov al, 1
mov ebx, 0
int 80h


; Transform temperature C2F
c2f:
mov edx, 0
imul eax,9
add eax,160
mov ebx, 5
idiv ebx
mov [reminder], edx

ret

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning