Home > Blockchain >  I have a Hexadecimal value in AL register in 8086 programming. How can I change it into decimal numb
I have a Hexadecimal value in AL register in 8086 programming. How can I change it into decimal numb

Time:07-09

I have a Hexadecimal value in AL register in 8086 programming. How can I change it into decimal number?

CodePudding user response:

You don't have a hexadecimal number, you have a binary number. That's the only kind in digital processors. If you need to display it in decimal - you need to convert it to ASCII string manually, here's an example: https://stackoverflow.com/a/23959237/4632951

CodePudding user response:

How can I change it into decimal number?

Use math!

If you have a number and want to know the value of the last digit, in decimal, you would do modulus 10.  So, if the number is 1234 then  on that would give you 4, and if the number is 5678, then  on that would yield 8.

Similarly, if you wanted to work on the 123 part you would divide 1234 by 10 to get 123.  Now you can  on that result to get 3.

There are algorithmic write ups of these, generally called itoa or integer to ascii/string.

  • Related