#### Archived

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

# 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.

## 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 on other sites
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 on other sites
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.

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

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632649
• Total Posts
3007644
• ### Who's Online (See full list)

There are no registered users currently online

×