Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Centigrade (Celsius) to Fahrenheit convertion and vice-versa.

; Centigrade (Celsius) to Fahrenheit
; calculation and vice-versa.
; (not very accurate, since using
; integer divide).

ORG 100h

JMP start

tc DB 10 ; t celsius.
tf DB 0 ; t fahrenheit.

result1 DB ? ; result in fahrenheit.
result2 DB ? ; result in celsius.

start:

; convert celsius to fahrenheit according
; to this formula: f = c * 9 / 5 + 32

MOV CL, tc
MOV AL, 9
IMUL CL
MOV CL, 5
IDIV CL
ADD AL, 32
MOV result1, AL

; convert fahrenheit to celsius according
; to this formula: c = (f - 32) * 5 / 9

MOV CL, tf
SUB CL, 32
MOV AL, 5
IMUL CL
MOV CL, 9
IDIV CL
MOV result2, AL

RET

Comments

  • Shawn CarterShawn Carter Member Posts: 0

    // http://forcoder.org // free video tutorials and ebooks about || Ruby Swift R PHP Go C Objective-C JavaScript C++ Visual Basic .NET C# Perl Assembly Delphi PL/SQL Visual Basic Python MATLAB Scratch Java Logo LabVIEW Transact-SQL Crystal Clojure Alice ABAP Dart ML F# SAS Prolog Fortran Rust D Lua Julia Scheme Ada Lisp VBScript FoxPro Apex COBOL Erlang Hack Scala Kotlin Bash Awk ||

Sign In or Register to comment.