0

I am very new in assembly language, and i can't understand this code.

mov byte [esp + 0x1], al

I'm not sure, but this line set the al value at esp+0x1 byte position right? In my case, al is never used with:

'mov al, <value>'

What is the value set in the first line if al doesn't have value?

phuclv
  • 37,963
  • 15
  • 156
  • 475
dl11
  • 5
  • 1

1 Answers1

0

I'm not sure, but this line set the al value at esp+0x1 byte position right?

That is correct. It's like [esp + 1] = al

al is a register and a register always has a value. Probably you haven't set it, but maybe an other function used it before.

MP13
  • 390
  • 3
  • 11
  • Thank you for the precision! If i haven't set it, its value is 0x0 ? –  dl11 Jul 30 '20 at 08:10
  • no. It's value is 0x0 when you set it or any other function to 0x0. You can never rely on the value of ``al`` when you have not set – MP13 Jul 30 '20 at 08:29
  • 3
    @dl11: You know that AL is the low byte of EAX, right? Did an earlier instruction do something like `movzx eax, byte [mem]` to efficiently load a byte, without partial-register-write problems? Because movzx load / byte store is how GCC normally copies a byte. – Peter Cordes Jul 30 '20 at 10:42
  • @PeterCordes good Comment. Forgot that to mention – MP13 Jul 30 '20 at 11:03
  • @PeterCordes Yes I had this instruction right before! I had forgot this detail :) thank you both for your help –  dl11 Jul 30 '20 at 12:31