Recursive function for finding factorial in Assembly Language


.type factorial function

.globl factorial

factorial:

pushl %ebp # Push base pointer address on top of stack for return purpose

movl %esp, %ebp # Now we will be using %ebp as a for all operations on stack

  1. subl $4,%ebp # Make room for local varibales

movl 8(%ebp), %eax # Take parameter in to the ebx

cmpl $1, %eax

je exit_factorial

decl %eax

pushl %eax

call factorial;

movl 8(%ebp), %ebx

imull %ebx,%eax

exit_factorial:

movl %ebp,%esp
popl %ebp
ret

About these ads

About pawanspace

I am a Sun certified Java programmer with 5 years of experience in IT industry. In past 5 years I have worked in Investment Banking Domain and Telecommunication domain. I have also worked on Business Intelligence domain. My mainstay has been Java, J2EE technologies. I am Bachelor of Engineering degree holder in Electronics and communication from Nagpur University. Before that I have done diploma in Electronics and Communication. Currently I am Working as Technical Analyst with Fujitsu, Noida. I joined Fujitsu on 8th Feb 2010. Earlier In Fujitsu I worked on Business Process Management product development. Currently I am working on a web application similar to Facebook and other Social applications similar to that. Working as Technical Analyst with Fujitsu, Noida. Prior to that I had worked as Sr. Software Engineer with GlobalLogic, Noida, Accenture Services pvt. ltd., Bangalore for 1 and half year. and a US MNC EXalt Solutions for 9 months. I am also pursuing correspondence MBA in Information Technology from Symboisis. My mainstay has been Java, J2ee Technologies. These are the major technologies I've used: Java Spring Spring MVC Hibernate Struts Stripes Coherence XML Parsers Jsp/Servlets I have also worked on JavaScript language. I have used following JavaScript frameworks: YUI Extjs Unit testing has also been a major part of my experience and I have used following frameworks: Unitils DBUnit JMock Junit FIT Besides these, I've used Ajax, JSON, XML, Web Services and XML Parsers like SAX and STAX. I've worked largely with Oracle database. I have experience in PL/SQL, reporting tools like BIRT and IBPM tool for Business Process Management. I have used Tomcat, Weblogic, JBoss and Jetty as web/app servers. I have worked mostly on Eclipse IDE but I do have experience with Netbeans as well.
This entry was posted in Assembly Language. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s