Understanding code
- From: "Trev" <spamtrap@xxxxxxxxxx>
- Date: 26 Oct 2006 02:14:24 -0700
Hi all,
Sorry to burden this newsgroup, but I'd like to ask a few more
questions.
Part of what I am doing is learning by example, looking at other
assembly language routines
and trying to figure out what is going on, but the following two
snippets of code have me stumped.
They are connected with fopen() and fprintf() calls.
Can anyone help?
--------------------------------
mov edi, dword ptr ss:[ebp+c] ; [ebp+c] contains a pointer to a string
that gives file format information, such as "%s%s"
xor esi, esi
mov bl, byte ptr ds:[edi]
inc edi
test bl, bl
..
..
..
mov dword ptr ss:[ebp+c], edi
je LABEL
..
..
..
LABEL:
..
..
..
---------------------------------------
The other bit of code is as follows:
mov edx, dword ptr ss:[esp+4] ; esp+4 is a pointer to the filename to
write to
test edx, edx
je short LABEL2
push edi
mov edi, edx
or ecx, ffffffff ; // ecx is "typically" 7f, and is an input
argument to this function
xor eax, eax
repne scas byte ptr es:[edi]
not ecx
dec ecx
pop edi
je LABEL2
mov eax, dword ptr ss:[ebp+8] ; ebp+8 is the file access specifier,
such as "rw"
test eax, eax
je short LABEL2
LABEL2 :
-----------------------------
TIA
Trev
.
- Follow-Ups:
- Re: Understanding code
- From: spamtrap
- Re: Understanding code
- Prev by Date: Re: How interrupts work (x86 vs. C64)
- Next by Date: Re: Understanding code
- Previous by thread: free Intel Disassembler for download
- Next by thread: Re: Understanding code
- Index(es):
Relevant Pages
|