SlideShare a Scribd company logo
Project # 3 Page 1 of 1
Mini-Project #3
Name: Date Performed:
Objectives:
‱ Addition/Subtraction
‱ ASCII to Hex (for 3 digits)
‱ Hex to ASCII
***Review***
‱ Hex-to-ASCII
Before a number could be displayed, it has to be converted to ASCII format. Given a 2-
digit number, the algorithm to convert hex to ASCII is as follows:
o Place the 2-digit number in register AL.
o Use AAM (ASCII Adjust for Multiplication) instruction. This instruction will
separate the 2 digit number to AH (ten) and AL (unit).
o Add 3030H to register AX.
* You could apply AAM twice if the number is greater than 100 but less than 255.
‱ ASCII-to-Hex
If the number to be manipulated is in ASCII format (i.e., via keyboard input), it has to be
converted to hex before it could be processed. Given a 2-digit number in ASCII format,
the algorithm to convert ASCII to HEX is as follows:
o Place the 2-digit number (ASCII format) in register AX.
o Use AAD (ASCII Adjust for Division) instruction. This instruction will combine
the number into register AL.
Instructions:
‱ Clear Screen.
‱ Place all basic I/O routines as functions in your main program: Clear Screen, Read String,
Write String, Read character w/o echo, Skip line (i.e. “n”), HEX-to-ASCII, ASCII-to-
HEX.
‱ Clear Screen.
‱ Input #1: First number (2 digits)
‱ Check for null input. If exists issue an error message and input again.
‱ Input #2: Second Number (2 digits)
‱ Check for null input. If exists issue an error message and input again.
‱ Convert ASCII input to HEX so that you could manipulate it properly.
‱ Display the SUM and DIFFERENCE of the two numbers. Note that if the result is
negative, you should place a negative sign in front of the number.
‱ Prompt the user whether the program will be executed again.
‱ See the example below for the output.
Project # 3 Page 2 of 2
First Number: 5
Second Number: 2
SUM = 7
DIFFERENCE = 3
Do you want to continue (Y/N)? Y
First Number: 0
Second Number: 99
SUM = 99
DIFFERENCE = -99
Do you want to continue (Y/N)? Y
First Number: 99
Second Number: 99
SUM = 198
DIFFERENCE = 0
Do you want to continue (Y/N)? N

More Related Content

PPTX
Flow chart and algorithm
PPS
Arithmetic Operations
PPTX
Sequential multiplication
PPTX
Multiplication algorithm, hardware and flowchart
PPTX
Multiplication algorithm
PPTX
Booth’s algorithm.(a014& a015)
PPTX
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
PDF
Integer represention
Flow chart and algorithm
Arithmetic Operations
Sequential multiplication
Multiplication algorithm, hardware and flowchart
Multiplication algorithm
Booth’s algorithm.(a014& a015)
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
Integer represention

What's hot (20)

PPT
computer arithmatic
PPTX
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
PPTX
3.3 graphs of exponential functions
PDF
Booth multiplication
PPTX
Adder substracter
PPTX
Sequential circuit multiplier
PDF
Examplelf flowchart
PPTX
Exercise6 ch2
 
PPT
Booths Multiplication Algorithm
PPTX
Booths algorithm for Multiplication
DOCX
Conversion of in fix pre fix,infix by sarmad baloch
PPTX
2 bit comparator (Digital Electronics)
DOCX
20BCE1734_Mridul_CSE2005_Lab-3.docx
PPTX
Half Adder and Full Adder
PPTX
Introduction to Half and Full Adder Circuit - Part 01 | Digital Logic Design |
PPT
types
PPTX
PPT
Computer architecture
PDF
C- Programming Assignment 3
PPTX
4-bit camparator
computer arithmatic
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
3.3 graphs of exponential functions
Booth multiplication
Adder substracter
Sequential circuit multiplier
Examplelf flowchart
Exercise6 ch2
 
Booths Multiplication Algorithm
Booths algorithm for Multiplication
Conversion of in fix pre fix,infix by sarmad baloch
2 bit comparator (Digital Electronics)
20BCE1734_Mridul_CSE2005_Lab-3.docx
Half Adder and Full Adder
Introduction to Half and Full Adder Circuit - Part 01 | Digital Logic Design |
types
Computer architecture
C- Programming Assignment 3
4-bit camparator
Ad

Similar to Programming Problem 3 (20)

PDF
Programming Problem 2
PDF
PDF
Topic 6 - Programming in Assembly Language_230517_115118.pdf
PDF
Alp 05
PDF
Alp 05
PPTX
Microprocessor chapter 9 - assembly language programming
PPTX
Assembly Language Programming
PPTX
8086p fundamental programming execution in masm
PDF
COMPUTER ORGANIZATION NOTES Unit 2
PDF
Alp 05
PPTX
Project
PPTX
Module 2 (1).pptx
PDF
Lecture6
PPTX
Mod-2.pptx
PPT
Instruction set of 8086
PPTX
Basic Input and Output
PPTX
8086 Instruction set
PPTX
6 assembly language computer organization
PPT
Assemblylanguageprogrammingof8085 100523023329-phpapp02
PPTX
COAL LAB 2 data addressing modes and register
Programming Problem 2
Topic 6 - Programming in Assembly Language_230517_115118.pdf
Alp 05
Alp 05
Microprocessor chapter 9 - assembly language programming
Assembly Language Programming
8086p fundamental programming execution in masm
COMPUTER ORGANIZATION NOTES Unit 2
Alp 05
Project
Module 2 (1).pptx
Lecture6
Mod-2.pptx
Instruction set of 8086
Basic Input and Output
8086 Instruction set
6 assembly language computer organization
Assemblylanguageprogrammingof8085 100523023329-phpapp02
COAL LAB 2 data addressing modes and register
Ad

More from Dwight Sabio (20)

PPTX
Human Rights Observatory Description
PDF
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
PDF
Report on Girl Children: A Rapid Assessment of their Situation
PDF
Gender ombud report 2016 final
DOCX
Strengthening legal referral mechanisms on cases of gender
PPTX
IP Report
PDF
CPU scheduling ppt file
PDF
Ch3OperSys
PDF
OperatingSystemChp3
PDF
ABC Supermarket
DOCX
Lab Activity
PPTX
Bluetooth
PDF
Arduino e-book
DOC
Midterm Project Specification
DOC
Game Design Document
DOC
Class diagram
DOCX
Midterm Project
PDF
ProgrammingProblem
PDF
Class Diagram
PDF
Lecture Notes
Human Rights Observatory Description
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
Report on Girl Children: A Rapid Assessment of their Situation
Gender ombud report 2016 final
Strengthening legal referral mechanisms on cases of gender
IP Report
CPU scheduling ppt file
Ch3OperSys
OperatingSystemChp3
ABC Supermarket
Lab Activity
Bluetooth
Arduino e-book
Midterm Project Specification
Game Design Document
Class diagram
Midterm Project
ProgrammingProblem
Class Diagram
Lecture Notes

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administration Chapter 2
PDF
AI in Product Development-omnex systems
PPTX
Transform Your Business with a Software ERP System
PDF
medical staffing services at VALiNTRY
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Introduction to Artificial Intelligence
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Design an Analysis of Algorithms I-SECS-1021-03
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PTS Company Brochure 2025 (1).pdf.......
System and Network Administration Chapter 2
AI in Product Development-omnex systems
Transform Your Business with a Software ERP System
medical staffing services at VALiNTRY
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Design an Analysis of Algorithms II-SECS-1021-03
Navsoft: AI-Powered Business Solutions & Custom Software Development
Introduction to Artificial Intelligence
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How Creative Agencies Leverage Project Management Software.pdf
ai tools demonstartion for schools and inter college

Programming Problem 3

  • 1. Project # 3 Page 1 of 1 Mini-Project #3 Name: Date Performed: Objectives: ‱ Addition/Subtraction ‱ ASCII to Hex (for 3 digits) ‱ Hex to ASCII ***Review*** ‱ Hex-to-ASCII Before a number could be displayed, it has to be converted to ASCII format. Given a 2- digit number, the algorithm to convert hex to ASCII is as follows: o Place the 2-digit number in register AL. o Use AAM (ASCII Adjust for Multiplication) instruction. This instruction will separate the 2 digit number to AH (ten) and AL (unit). o Add 3030H to register AX. * You could apply AAM twice if the number is greater than 100 but less than 255. ‱ ASCII-to-Hex If the number to be manipulated is in ASCII format (i.e., via keyboard input), it has to be converted to hex before it could be processed. Given a 2-digit number in ASCII format, the algorithm to convert ASCII to HEX is as follows: o Place the 2-digit number (ASCII format) in register AX. o Use AAD (ASCII Adjust for Division) instruction. This instruction will combine the number into register AL. Instructions: ‱ Clear Screen. ‱ Place all basic I/O routines as functions in your main program: Clear Screen, Read String, Write String, Read character w/o echo, Skip line (i.e. “n”), HEX-to-ASCII, ASCII-to- HEX. ‱ Clear Screen. ‱ Input #1: First number (2 digits) ‱ Check for null input. If exists issue an error message and input again. ‱ Input #2: Second Number (2 digits) ‱ Check for null input. If exists issue an error message and input again. ‱ Convert ASCII input to HEX so that you could manipulate it properly. ‱ Display the SUM and DIFFERENCE of the two numbers. Note that if the result is negative, you should place a negative sign in front of the number. ‱ Prompt the user whether the program will be executed again. ‱ See the example below for the output.
  • 2. Project # 3 Page 2 of 2 First Number: 5 Second Number: 2 SUM = 7 DIFFERENCE = 3 Do you want to continue (Y/N)? Y First Number: 0 Second Number: 99 SUM = 99 DIFFERENCE = -99 Do you want to continue (Y/N)? Y First Number: 99 Second Number: 99 SUM = 198 DIFFERENCE = 0 Do you want to continue (Y/N)? N