Skip to main content
3 of 3
added 66 characters in body
JRE
  • 73.6k
  • 10
  • 112
  • 195

What commands in assembly cast value from hexa to decimal when they are called?

how can I know if a command is treating an immediate as a decimal or as a hexadecimal? For e.g div casts the values into decimal before it makes the arithmetic division:

.data
x: .quad 0x16
y: .quad 0x7
z: .space 8

.text
.global main
main:
    xor %rax, %rax
    xor %rbx, %rbx
    xor %rdx, %rdx
    movq x, %rax  
    movq y, %rbx
    div %rbx
    movq %rax, z
    ret

I'm getting those results:

enter image description here

and my guess is that div looks at the decimal value of the number inside a register (cast it from hex to dec) but is it always like that in all arithmetic commands? Are there commands from different type that also act like this? I've tried reading the manual, but it doesn't specified there, I found it out by accident when debugging in sasm.

Thank you very much for your time and attention.

E. Ginzburg
  • 207
  • 1
  • 2
  • 9