8 Replies - 1221 Views - Last Post: 26 June 2012 - 12:46 AM

#1 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Need help to understand a brief assembly code

Posted 23 June 2012 - 11:35 AM

Hi all, I'm newbie here.

Please don't blame me for being lazy. I know nothing of Assembly and I need to know what the following codes mean/does. The codes look simple to some one experienced I guess.

Could anyone help me? It would save me from reading some assembly books. Thanks a lot.



.386
.model flat

option prologue:none
option epilogue:none
option dotname

.code
align DWORD
DllMain     proc    stdcall public, instance:DWORD, reason:DWORD, reserved:DWORD
        mov     eax, 1
        ret	12
DllMain     endp


align DWORD
DynamicCallFunc	proc	stdcall	public, funcptr:DWORD
	pop	ecx
	pop	edx
	push	ecx
	jmp	edx
DynamicCallFunc	endp

end




Is This A Good Question/Topic? 0
  • +

Replies To: Need help to understand a brief assembly code

#2 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 870
  • View blog
  • Posts: 2,310
  • Joined: 28-March 11

Re: Need help to understand a brief assembly code

Posted 23 June 2012 - 01:20 PM

Why do you need to know what the code does if you don't know Assembly? Just open a book and learn Assembly, this is super beginner stuff.

Would this make it clearer as to what it is doing?
DynamicCallFunc	proc	stdcall	public, funcptr:DWORD
    pop     eax
    push    dword ptr[esp]
    jmp     dword ptr[esp + 4]
DynamicCallFunc	endp


Was This Post Helpful? 0
  • +
  • -

#3 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Re: Need help to understand a brief assembly code

Posted 24 June 2012 - 11:27 PM

I need to convert this assembly code to another language. So all I want is knowing what the code means. Reading a book is fine but would take too much time and may not be necessary as I may not deal with assembly again anytime soon.

Please give me a help.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5395
  • View blog
  • Posts: 27,389
  • Joined: 10-May 07

Re: Need help to understand a brief assembly code

Posted 24 June 2012 - 11:33 PM

View Postoctech, on 25 June 2012 - 02:27 AM, said:

I need to convert this assembly code to another language.

So more over you were looking for code for a project or homework assignment & unfortunately for you, you only found it provided in assembly code. Therefor, you need someone to convert the code to the language of your assignment so you can hand it in.

I would think a better approach would be to not even mess with the assembly code, since as you put it, it's a waste of time. Instead why not open a topic under the desired langauge, & show us what you have done thus far, & we maybe able to help with any problems you are having in your assignment.

Language translation is no easy task. One must understand them both. & if you are finding projects in one language rather than another, I think it will take you much longer to get there.
Was This Post Helpful? 0
  • +
  • -

#5 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Re: Need help to understand a brief assembly code

Posted 24 June 2012 - 11:59 PM

I need to convert this assembly code to another language. So all I want is knowing what the code means. Reading a book is fine but would take too much time and not be necessary as I may not deal with assembly again anytime soon.

Please give me a help.
Was This Post Helpful? 0
  • +
  • -

#6 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Re: Need help to understand a brief assembly code

Posted 25 June 2012 - 12:05 AM

View Postno2pencil, on 24 June 2012 - 11:33 PM, said:

So more over you were looking for code for a project or homework assignment & unfortunately for you, you only found it provided in assembly code. Therefor, you need someone to convert the code to the language of your assignment so you can hand it in.


No, it's not a homework. I was required by my boss to rewrite this application in another language which I master well. The problem is I don't know assembly and have no idea what the assembly code does. So if someone could tell me its meaning, the translation should be an easy part for me.

As it's very short, I suppose it's not too hard to tell if you are experienced.
Was This Post Helpful? 0
  • +
  • -

#7 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 870
  • View blog
  • Posts: 2,310
  • Joined: 28-March 11

Re: Need help to understand a brief assembly code

Posted 25 June 2012 - 02:34 PM

So write it from scratch in whichever language you "master well".

Now if you want me or someone else to write the code for you, we do charge for our time.

It takes a pointer to a function and calls that function, that is what it does; now you can write it.
Was This Post Helpful? 0
  • +
  • -

#8 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Re: Need help to understand a brief assembly code

Posted 25 June 2012 - 09:28 PM

View PostGunnerInc, on 25 June 2012 - 02:34 PM, said:

So write it from scratch in whichever language you "master well".

Now if you want me or someone else to write the code for you, we do charge for our time.


Writing from scratch is certainly what I was going to do from the first day. I never asked anyone to write the code for me, I only asked what the assembly code means.

Quote

It takes a pointer to a function and calls that function, that is what it does; now you can write it.


It makes sense. So the input to this dll should be the name of the function to be called, correct?
Was This Post Helpful? 0
  • +
  • -

#9 octech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-June 12

Re: Need help to understand a brief assembly code

Posted 26 June 2012 - 12:46 AM

Oop, my mistake sorry. What I mean was how it deals with arguments of the function or the function must have no argument? Thanks,
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1