asm and labels

Started by
3 comments, last by sprinter_trueno 21 years ago
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
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]
"The Gods Made Heavy Metal And They Saw That It Was Good They Said To Play It Louder Than Hell We Promised That We WouldWhen Losers Say Its Over With You Know That It's A Lie The Gods Made Heavy Metal And It's Never Gonna Die"THE GODS MADE HEAVY METAL/by ManOwaR
Thanks for the comment.

Imagine the following:


  void foo(){..mov eax,0push Continuejmp ExternalCodeContinue: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.

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
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?

This topic is closed to new replies.

Advertisement