|
-
March 22nd, 2007, 12:12 AM
#2
Re: hex binary etc
I'm assuming you want to convert them to ascii. Binary is fairly simple.
Just load the number into a register shift left, the carry flag will tell you if the next digit is a zero or a one, store it into your buffer, repeat for all the bits in the register.
Converting to decimal requires a bit of knowledge of the ASCII table.
Work on it one byte at a time. Each nibble in the byte represents one hex digit which still needs to be converted into a decimal digit.
-isolate the high order nibble
-OR it with char '0'
-if the result is greater than char '9', then add 7 (not char '7'!) to the result.
-append this into your buffer.
-repeat with low order nibble.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|