Solved

What does this assembly code do

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

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
What is the -401h, -1, and 8 in the assignment statements?
0
 
LVL 82

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now