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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education