Re: [Tuxnes-devel] more help w/ asm
Brought to you by:
tmmm
From: Jim U. <ji...@3e...> - 2001-04-11 21:17:13
|
At 03:40pm on 2001 April 11, Rigel did write: > I was wrong, then, because I meant load into ebx the value at the mem location held in edi. > So if I say, > leal 4(%ebx),%edi > then I mean (in C), > edi = ebx + 4 Exactly. With lea you can do a mul, add, AND a shl (by 2,4,or 8) in only one instruction, but it can also be used to just do a single mov, add, or shl. lea is a special instruction that performs all address computations, then moves this address result into a register. For example, leal 4(%ebp,%ebx,2),%edi does (in C) edi = ebp + ebx*2 + 4; What you want is movl (%edi), %ebx. This is like saying ebx = *edi. This is also equivalent to movl 0(%edi), %ebx -- the 0 is superfluous. In intel syntax, lea eax, [ebx] == mov eax, ebx. You may just be confused by the AT&T syntax, but here are some resources: LEA documentation in intel syntax at: http://webster.cs.ucr.edu/Page_asm/ArtofAssembly/CH06/CH06-1.html#HEADING1-136 Scaled indexed addressing modes at: http://webster.cs.ucr.edu/Page_asm/ArtofAssembly/CH04/CH04-3.html#HEADING3-49 Register indirect and indexed addressing modes at: http://webster.cs.ucr.edu/Page_asm/ArtofAssembly/CH04/CH04-2.html#HEADING2-35 -- 'I came to the 3-day "breatharian" seminar in Hawaii, but without the $300 fee to attend. Wiley asked me: "If you can't find $300, then how do you expect to find God?"' -- breatharian.com ji...@3e... / 0x43340710 / 517B C658 D2CB 260D 3E1F 5ED1 6DB3 FBB9 4334 0710 |