Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What does this assembly code do

Posted on 2014-04-07
4
Medium Priority
?
464 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

Expert Comment

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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Six Sigma Control Plans
Progress

670 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