Convert decimal to hex in assembly

后端 未结 1 1647
挽巷
挽巷 2021-01-29 01:57

Can someone explain to me decimal to hex conversion algorithm in assembly?I have a decimal value in a variable and I should print it as a hex value.Print should look like this:

1条回答
  •  心在旅途
    2021-01-29 02:40

    Assuming that this is a homework, here's a couple of hints:

    • The value in the variable is not in decimal, hex, or any other system: it is in whatever system that your hardware supports (most likely, it is binary).
    • To convert a value to hex, you need to separate out 4-bit chunks by shifting right and masking with 0x0F, and indexing into an array of hexadecimal digits.

    0 讨论(0)
提交回复
热议问题