Solved

What does this assembly code do

Posted on 2014-04-07
4
445 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
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

860 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