I started with debuging so I now debug all programs I can to understand the full work off microprocessor.

I know basic ASM level so no problem here.

look what i wana ask

--- c:\users\zippo\documents\visual studio 2008\projects\debug\debug\main.cpp --
#include <iostream>
using namespace std;

int main()
{
00031370  push        ebp  
00031371  mov         ebp,esp 
00031373  sub         esp,0D8h 
00031379  push        ebx  
0003137A  push        esi  
0003137B  push        edi  
0003137C  lea         edi,[ebp-0D8h] 
00031382  mov         ecx,36h 
00031387  mov         eax,0CCCCCCCCh 
0003138C  rep stos    dword ptr es:[edi] 
   int a = 5;
0003138E  mov         dword ptr [a],5 
   int b = 5;
00031395  mov         dword ptr [b],5 

   a = a + b;
0003139C  mov         eax,dword ptr [a] 
0003139F  add         eax,dword ptr [b] 
000313A2  mov         dword ptr [a],eax 

	return 0;
000313A5  xor         eax,eax 
}

The first code rows in my main are there why??
What is this stuff??

00031370  push        ebp  
00031371  mov         ebp,esp 
00031373  sub         esp,0D8h 
00031379  push        ebx  
0003137A  push        esi  
0003137B  push        edi  
0003137C  lea         edi,[ebp-0D8h] 
00031382  mov         ecx,36h 
00031387  mov         eax,0CCCCCCCCh 
0003138C  rep stos    dword ptr es:[edi]

really needed?

The is setting up the function's stack, allocating local variable space on the stack, and initializing them with 0x0c for debug purposes (helps to detect buffer overflows). Similar code is at the beginning of every function.

Edited 6 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.