answersLogoWhite

0

## temp.a ask user for temperature in Celsius,

## convert to Fahrenheit, print the result.

##

## v0 - reads in celsius

## t0 - holds Fahrenheit result

## a0 - points to output strings

##

#################################################

# #

# text segment #

# #

#################################################

.text

.globl __start

__start:

la $a0,prompt # print prompt on terminal

li $v0,4

syscall

li $v0,5 # syscall 5 reads an integer

syscall

mul $t0,$v0,9 # to convert,multiply by 9,

div $t0,$t0,5 # divide by 5,then

add $t0,$t0,32 # add 32

la $a0,ans1 # print string before result

li $v0,4

syscall

move $a0,$t0 # print result

li $v0,1

syscall

la $a0,endl # system call to print

li $v0,4 # out a newline

syscall

li $v0,10

syscall # au revoir...

#################################################

# #

# data segment #

# #

#################################################

.data

prompt: .asciiz "Enter temperature (Celsius): "

ans1: .asciiz "The temperature in Fahrenheit is "

endl: .asciiz "\n"

##

## end of file temp.a

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra

Add your answer:

Earn +20 pts
Q: Assembly language programme 8051 convert degree to Fahrenheit?
Write your answer...
Submit
Still have questions?
magnify glass
imp