Log in

View Full Version : Characterisic of asm


Ja187
April 26th, 2005, 06:06
Hello!
Where I can find info about asm. I'm not searching for tutorial how to write progs in asm, but characteristic about this language.

Hero
April 26th, 2005, 06:39
hi
What do you mean by:
Quote:
characteristic about this language.

???
You mean the way that an asm program compiles to object code?

sincerely yours

Ja187
April 27th, 2005, 03:25
Hello!
Ok, I got it already, but thanks for reply.
Ps. I have an exercise. I must do sth like comparing characteristic of asm with c++ language.

bilbo
April 27th, 2005, 06:09
Please don't tell them that C++ is Object Oriented and ASM isn't!
Have a look at http://objasm32.tripod.com, if yet in doubt...

Regards, bilbo

JMI
April 27th, 2005, 09:07
So what you want is that someone here do your homework research assigment for you? Would that mean that you would get a "0" and the person who gives you the answer would get the grade for the assignment? Since this is school work, don't you think you should "earn" your own grade?

Did you actually read that part in the FAQ which says you should state what YOU have done to try to help yourself beside ask for the answer here? Does not appear that you are going to do well on either assignment.

Regards,

Silver
April 28th, 2005, 05:33
Bilbo, come on, there's a bit of a difference between a language designed to be OO and a language where someone has implemented (an admittedly excellent) convoluted solution

There's a very good pdf of a book I read a while ago titled something like "Object Oriented Programming in x86". Most of it was beyond my asm ability but the author made some interesting points and gave good sample code.

nikolatesla20
April 28th, 2005, 06:57
Hm what are u guys talking about...well, for one, I wouldn't try to write OO is asm - when I have c++ I'll just use that for now. But I do remember seeing a nice book at the bookstore all about asm and OO in asm and everything. Pretty cool.

Anyway, OO is just pointers to objects anyway, in asm it's not that big of deal.

Maybe ja187 would find this interesting (rest of use know this stuff already):

Say you have a object "Homework" from class "CHomework"

Code:

class CHomework
{
private:
char Grade;

public:
CalculateGrade(PAPER* ThePaper);

};



and now in code you create the object

Code:


CHomework* MyHomework;
PAPER MyPaper;

MyHomework = new CHomework();

MyPaper = "this is the difference between asm and.....";

MyHomework->CalculateGrade(&MyPaper);





In memory your object exists, the object itself is just data but the same functions getted called or all objects of that class. In other words if you have a MyHomework2 and call CalculateGrade it calls the same function in memory as MyHomework does. The function knows which object to work on because of a hidden "this" pointer that gets passed in along with the normal argument.

Anyway in asm it looks more like this....

Code:


mov ebx, <pointer to object> <- remember a pointer is a variable too
mov eax, [ebx] <- eax now has object address itself (that pointer pointed to)
mov ebx, <pointer to PAPER structure>
mov ebx, [ebx] <- get the paper structure address from the pointer
push ebx <- pass in argument
push eax <- pass in "this" pointer
call [eax + 0x1C] <- call function on object



Guys correct me if I'm wrong, I'm a bit rusty since I've been away from my computer for a couple of months doing other things.


-nt20