Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

sprinter_trueno

asm and labels

This topic is 5639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, being pretty new to inline assembler I got a question using assembler within class and class members. Situation as following: The members of my class are all implemented in asm but need to execute common asm code which I could place in other members. But that would be a waste since that code segment is very small. So I''d like to jump to that code without calling a function, pushing regs and reserving some local mem. How do I implement this ? Is there a good site to get some examples ? Thanks for any reply Lorenz

Share this post


Link to post
Share on other sites
Advertisement
Let we say that it is posible, then tell me how you will know the return path? You will HAVE TO put some information about return path, so you will do what CALL (func) do.
Better write class member without any params, call it as function (the return path will go on stack), and allways put parameters to this same registers.
But in reallity you will not save to much CPU cycles or size

ps. Sorry for my english


[edited by - Estor on April 18, 2003 5:52:55 AM]

Share this post


Link to post
Share on other sites
Thanks for the comment.

Imagine the following:


  

void foo()
{
.
.
mov eax,0
push Continue

jmp ExternalCode

Continue:
mov eax,1
.
.
}


ExternalCode is(would be) a label defined in the header of the class. But I do not know if this ''declaration'' is possible and if, how.

Share this post


Link to post
Share on other sites
Dunno if this is the method supposed to be used but it is working.


  

__forceinline void subfoo()
{
// Use the regs as they come

}

void foo()
{
_asm
{
// Do stuff

}

subfoo(); // Will be inline


_asm
{
// Go on doing stuff with regs intact

}

} // End foo




Could anybody rate this ? Don''t have a clue whether this is the way it should be.

Thanks

Share this post


Link to post
Share on other sites
ExternalCode should be a memory location.
Which would be generated by the assembler.

Ex:

Entry:
"code"
jmp Entry


this will do whatever is inside code, then it will jump to Entry.

Entry: is just a label that defines the code location to jump to.

Have you tried if your assembler can use label, like above, to?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!