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

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

.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.

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.

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.

added 5 characters in body; edited tags; edited title
Source Link
Mitu Raj
  • 11k
  • 6
  • 25
  • 48

what 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 makemakes 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? areAre there commnadscommands 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.

thankThank you very much for your time and attention.

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? e.g div casts the values into decimal before it make 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 commnads 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.

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.

Source Link
E. Ginzburg
  • 207
  • 1
  • 2
  • 9

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? e.g div casts the values into decimal before it make 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 commnads 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.