decimal to hex

Started by
3 comments, last by redneckCoder 21 years, 11 months ago
The assembly tutorial I read, this first on the x86 assmebly list in "Articles and Resources" shows decimal to binary, binary to decimal, and binary to hex conversions. What I need to know is how to convert decimal to hex without having to convert it to binary first. How do I do this? Thanks. -AJ C:\DOS C:\DOS\RUN RUN\DOS\RUN -Comic Book Store Guy''s t-shirt that I saw on the Simpsons, although it didn''t actually come from the Simpsons. http://vdsoft.netfirms.com/home.html
C:DOSC:DOSRUNRUNDOSRUN-Comic Book Store Guy's t-shirt that I saw on the Simpsons, although it didn't actually come from the Simpsons.http://vdsoft.netfirms.com/home.html
Advertisement
From decimal to hex divide by 16.
Even though I don''t know how to do the conversion, I''m fairly certain it isn''t a simple divide by 16. Anyone have the real answer? Thanks.

-AJ

C:\DOS
C:\DOS\RUN
RUN\DOS\RUN

-Comic Book Store Guy''s t-shirt that I saw on the Simpsons, although it didn''t actually come from the Simpsons.

http://vdsoft.netfirms.com/home.html
C:DOSC:DOSRUNRUNDOSRUN-Comic Book Store Guy's t-shirt that I saw on the Simpsons, although it didn't actually come from the Simpsons.http://vdsoft.netfirms.com/home.html
Well I don''t know how your supposed to do it but I just multiply the first number by 16 and add the second number. I.E. 3F= (3 * 16) + 15.
you can use the same procedure that you use to convert to base 2, only apply it to base 16. First find the highest power of 16 that is <= the number you are converting. Then divide that into the number, which becomes the first digit. Take the remainder and the next lowest power of 16 and divide, repeat etc.

For example, take the number 456. The highest power is 16^2, which is 256. 456 / 256 = 1 R 200. The first digit is 1. 200 / 16^1 is 12 R 8, so the next digit is C. The last digit is 8 since that's all you have left at 16^0. So 456 base 10 == 1C8 base 16.

BTW ElCrazon -> that's hex to decimal and the question was decimal to hex

No, HTML is not an OO language.

[edited by - masonium on April 30, 2002 9:22:37 PM]

This topic is closed to new replies.

Advertisement