2. UNIVERSITY OF ENGINEERING AND
TECHNOLOGY
LAHORE, NAROWAL CAMPUS
Submitted To: MA’AM Fatima
Submitted By: Zoha Afzal (2022 – CS – 563)
Asim Shahzad (2022 – CS – 547)
Abdulahad (2022 – CS – 549)
Aiza Eman (2022 – CS – 563)
Section: A
3. INTRODUCTION
The assembly code is designed for a
temperature conversion program on the Intel
x8086 architecture. This program serves as a
practical example of implementing a menu-
driven interface to convert temperatures
between Celsius, Fahrenheit, and Kelvin.
Developed with the purpose of educational
illustration, the code employs fundamental
assembly language concepts such as
input/output operations, conditional branching,
and subroutine usage.
Temperature Converter 3
4. PRIMARY GOALS
To convert the temperature
between Celsius, kelvin and
Fahrenheit using emu8086
assembly language. The
conversions are from:
• Celsius to
Fahrenheit
• Fahrenheit to
Celsius
• Celsius to Kelvin
5. CODE OVERVIEW
Overview of the main components:
• ".data" section: Declaration of input and output strings, menu prompts and
error messages.
• ".code" section: Main program logic
• Function calls: scan_num, print_num, and exit handling
• Global variables: “g” and “a” are declared in ‘data’ section to store user
inputs and selections.
Temperature Converter 5
6. PROGRAM STRUCTURE
Structure breakdown:
• Initial setup: Displaying the
temperature conversion menu
• Menu options from 1 to 7 for various
conversions
• Handling user input and calling
respective conversion functions
6
7. CONVERSION FUNCTIONS
Temperature Converter 7
• Function 1: Celsius to Fahrenheit
Formula used: °F = °C × (9/5) + 32
• Function 2: Fahrenheit to Celsius
Formula used: °C = (°F – 32) × (5/9)
• Function 3: Celsius to Kelvin
Formula used: Kelvin = °C + 273
8. CONVERSION FUNCTIONS
(CONT…)
8
• Function 4: Fahrenheit to Kelvin
Formula used: K = (° F − 32) × 5 ⁄ 9 +
273
• Function 5: Kelvin to Celsius
Formula used: °C = K – 273
• Function 3: Kelvin to Fahrenheit
Formula used: °F = (K − 273) × 9/5 +
32
9. ERROR HANDLING AND EXIT
Temperature Converter 9
• Repetition and Error Handling:
- After each conversion or error, the program provides the
option to return to the main menu or exit.
- If an invalid input is entered, an error message is displayed,
and the program returns to the main menu.
• Exit Program Section:
- The `exit_program` section displays a termination message
and exits the program using DOS interrupt 21h function
4Ch.
- The program terminates with the `END` directive.
10. CONCLUSION
10
This assembly code creates a menu-driven program that helps
convert temperatures between Celsius, Fahrenheit, and Kelvin
on the Intel x8086 platform. It showcases how to handle user
choices, manage data input and output, and navigate through
different temperature conversion options. The code is
organized into smaller, specialized sections for each type of
conversion, making it easy to understand and maintain. It
demonstrates how to guide user interactions and execute
specific tasks based on their selections.