For Programmers: Free Programming Magazines  


Home > Archive > A86 Assembler > December 2007 > Celsius To Fahrenheit









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Celsius To Fahrenheit
Tipotas688

2007-12-06, 8:23 am

Hello I have a problem with this converter I made.

cr equ 13;
lf equ 10;

JMP START

entertemp:DB 'Please enter the temperature to convert --->',cr,lf,' $'
entertype: DB 'Please enter type of convertion to Celcius(C) or to Fahrenheit(F) $'
temperature DB ?




START:


LEA DX,entertemp
MOV ah,9
INT 21h

MOV AH,1
INT 21h
SUB Al,30H
MOV temperature,Al



LEA DX,entertype
MOV ah,9
INT 21h

MOV AH,1
INT 21h


CMP al,'C'
JE Celc
JNE Fahr

Celc: MOV al,temperature
Mov cx,9
MUL cx

mov cx,5
DIV cx


MOV AH,02H
INT 21H
ADD al,32
JMP START

Fahr: MOV al,-32
mov cx,5
MUL cx

ADD al,temperature
mov cx,9
DIV cx
MOV AH,02H
INT 21H


next: MOV AH,9
INT 21H
MOV AH,4Ch
INT 21h

It doesnt print out the result of the convertion. I think its because I only put one character as the number to be converted but I dont know how to do it in any other way... Also there is a problem with the JNE case... Instead of showing the result if "F" is pressed the program terminates...

Thanks in advance:)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com