how does LEA and several instruction work?

assembly, x86

Solution

The first two load the contents of 32 bits pointed to by `bx` into `ds` and `si` (or `es` and `di`).

The second two are the same because the values are literals. If, however they were:

lea di,[bx]
mov di,[bx]

then your expectation would be right: the former putting the address `bx` into `di` and the latter putting the 16 bits pointed to by `bx` into `di`.

For more information on both, see this question for `les`/`lds` and this question for `mov`/`lea`.

Problem

I dont fully understand the meaning of first two lines, and the difference of last two lines.. ``` LDS SI,[BX] LES DI,[BX] LEA DI,5000h MOV DI,5000h ``` I think LEA loads 5000h in DI and MOV loads content of 5000h in DI. Am I right??

Original source

Related problems