The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: mineiro on December 03, 2011, 05:07:50 AM

Title: simply lea question
Post by: mineiro on December 03, 2011, 05:07:50 AM
Hello Sr's, I'm confused now about lea, I read StrLen.asm and have the line below:

    lea     ecx, [edi-01010101h]    ; subtract 1 from each byte
generated listing give me:
8D 8B FEFEFEFF           lea     ecx, [ebx-01010101H]

olly reports:
Address   Hex dump          Command                                  Comments
00401011  |.  8D8B FFFEFEFE LEA ECX,[EBX+FEFEFEFF]


why that FF?

should be?:
    lea     ecx, [edi-01010102h]    ; subtract 1 from each byte
8D 8B FEFEFEFE           lea     ecx, [ebx-01010102H]

CPU Disasm - olly reports
Address   Hex dump          Command                                  Comments
00401011  |.  8D8B FEFEFEFE LEA ECX,[EBX+FEFEFEFE]

the same to poasm.
Title: Re: simply lea question
Post by: MichaelW on December 03, 2011, 05:25:26 AM

include \masm32\include\masm32rt.inc
.code
start:
    print hex$(-01010101h),13,10
    inkey
    exit
end start


FEFEFEFF


Title: Re: simply lea question
Post by: mineiro on December 03, 2011, 09:11:09 AM
Thank you for the answer Sr MichaelW, I was tired when have posted, a simple 2 complement.
well, I need stop working a bit,