Solved

What does this assembly code do

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

773 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