Solved

What does this assembly code do

Posted on 2014-04-07
4
462 Views
Last Modified: 2014-04-09
Trying to study some assembly code. What does the following line of assembly do?

sub_4012C6 proc near

var_401 = dword ptr -401h
var_1 = dword ptr -1
arg_0 = dword ptr 8

push ebp
mov ebp, esp

Open in new window


Thank you.
0
Comment
Question by:centem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39985342
It's been a while since I've done assembly code.  That looks like "procedure entry" code.  The procedure, 'sub_4012C6', is declared followed by 3 variables.  Then 'ebp' is saved on the stack and the stack pointer is copied to 'ebp'.  After that will come some code that gets and processes the variable data relative to the offset from the current value of 'ebp'.

It is normal to push the data onto the stack before calling a procedure.  This code gives the info to access the data on the stack.
0
 

Author Comment

by:centem
ID: 39988724
What is the -401h, -1, and 8 in the assignment statements?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39989184
Probably the offsets from the stack point or 'ebp' where the data is located.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question