News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

simply lea question

Started by mineiro, December 03, 2011, 05:07:50 AM

Previous topic - Next topic

mineiro

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.

MichaelW


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


FEFEFEFF


eschew obfuscation

mineiro

Thank you for the answer Sr MichaelW, I was tired when have posted, a simple 2 complement.
well, I need stop working a bit,