Hello everyone!
In this blog, I will be discussing HEXADICMAL to ASCII conversion method.
To begin with, I will first explain method for conversion of 1 single byte
Then moving further, to convert a word.
Then you can try on your own for double word,Quad word.
There are two implementation methods for HEXADICMAL to ASCII
Question 1:
Why do we need HEXADICMAL to ASCII conversion?
For printing purposes, ASCII values are for each character. So, to display any character on screen we need to pass its ASCII equivalent to standard output file. This is the simplest way to explain the need for conversion from HEXADICMAL to ASCII.
Code for conversion of byte:
For Byte conversion click here
Code for conversion of word:
For Word conversion click here
For a quick refrence:
ASCII TABLE
INTEL REFERENCE MANUAL
For Working of XLAT instruction (only for method 2) click here or read 4-591 of above link.
Here, given flow chart assumes only a sinlge digit Hexadecimal value to be converted.
The same can be used for any length of number to be converted.
METHOD 1:
Algorithm:
1.Take the MSB of byte
2.Using XLAT get equivalent ASCII value for MSB (MSB will act as offset for reference table)
3.Store converted value
4.Take the LSB of byte
5.Using XLAT get equivalent ASCII value for LSB (LSB will act as offset for reference table)
6.Store converted value
If there is any wrong information posted in this blog, please infrom me.
Your feedbacks will be very helpful for me.
No comments:
Post a Comment