Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Inline Assembler Question
I am looking for a way to use the "indirect jump" within a routine, actually how to create your own "switch case" using inline-assembly. Suppose I have this: switch(var) { case 0 : goto label_00; case 1 : goto label_01; case 2 : goto label_02; case 3 : goto label_03; case 4 : goto label_04; } Then how do I create the (jump) addresses for label_00, label_01 ........ label_04 ? I couldn't find the answer in the documentation. Thanks for answers. My best, Ed Nov 10 2003
"Ed Schroder" <rebel777 home.nl> wrote:I am looking for a way to use the "indirect jump" within a routine, actually how to create your own "switch case" using inline-assembly. Suppose I have this: switch(var) { case 0 : goto label_00; case 1 : goto label_01; case 2 : goto label_02; case 3 : goto label_03; case 4 : goto label_04; } Then how do I create the (jump) addresses for label_00, label_01 ........ label_04 ? Nov 10 2003
Thanks Gisle for answer. I am aware of the call-technique and practice it wherever it is useful. But in the end the "switch-case" command when it is compiled creates such a jump-table. Meaning, if the compiler can why shouldn't the user? When you watch the assembler output the indirect jump is present including a generated jump-table. I am sure there must be some tricky way to create the jump-table yourself. I just hope Walter is reading this :) My best, Ed ================== "Gisle Vanem" <giva users.sourceforge.net> wrote in message news:booinr$15um$1 digitaldaemon.com..."Ed Schroder" <rebel777 home.nl> wrote:I am looking for a way to use the "indirect jump" within a routine, Nov 11 2003
At the moment, you can't create a jump table with the inline assembler. Sorry. "Ed Schroder" <rebel777 home.nl> wrote in message news:boqcn4$pk9$1 digitaldaemon.com...Thanks Gisle for answer. I am aware of the call-technique and practice it wherever it is useful. Nov 11 2003
"Walter" <walter digitalmars.com> wrote in message news:bor6u2$211k$1 digitaldaemon.com...At the moment, you can't create a jump table with the inline assembler. Sorry. Nov 12 2003
"Ed Schroder" <rebel777 home.nl> wrote in message news:bost9i$1mjv$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message news:bor6u2$211k$1 digitaldaemon.com...At the moment, you can't create a jump table with the inline assembler. Sorry. Nov 12 2003
"Walter" <walter digitalmars.com> wrote in message news:bot23j$1tmm$1 digitaldaemon.com..."Ed Schroder" <rebel777 home.nl> wrote in message news:bost9i$1mjv$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message news:bor6u2$211k$1 digitaldaemon.com...At the moment, you can't create a jump table with the inline Nov 14 2003
Just by way of asking a dumb question, you can't have the switch statement in C and have it jump to some inline assembler code? Keith Fuller keithfx H*tmail.com In article <boofcq$10sl$1 digitaldaemon.com>, Ed Schroder says...I am looking for a way to use the "indirect jump" within a routine, actually how to create your own "switch case" using inline-assembly. Suppose I have this: switch(var) { case 0 : goto label_00; case 1 : goto label_01; case 2 : goto label_02; case 3 : goto label_03; case 4 : goto label_04; } Then how do I create the (jump) addresses for label_00, label_01 ........ label_04 ? I couldn't find the answer in the documentation. Thanks for answers. My best, Ed Nov 11 2003
|