Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Doubt

Status
Not open for further replies.

Khabz

Programmer
Mar 19, 2013
1
0
0
Hey there I'm a newbie at assembly so I'd like someone to help me out w/ the following.

On the following code:

mov esi, offset Vec
mov eax, [esi]

Esi contains the 1st position of the vector and Eax contains the 1st number of the same vector.

And here:
mov edi, offset (vec + 4)
mov ebx, [edi]

Edi gets the 2nd position of the vector and ebx contais the 2nd number or is it incorrect?

Consider it to be DWORDS.
 
It's a very long time since I did any assembler programming, but from memory I think you are right.

As far as I can see [tt]esi[/tt] is set as a pointer to the start of the vector and [tt]eax[/tt] picks up the value at that point. The next line the vector pointer is moved 4 bytes and the value loaded into [tt]ebx[/tt].

Personally I would have left the pointer [tt]esi[/tt] in its inital position - the start of the vector and picked up the value as [tt]mov ebx, [esi + 4][/tt].

But as I said I am very rusty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top