Borland x86 inlined assembler; get a label's address?

前端 未结 12 871
清酒与你
清酒与你 2021-01-05 03:15

I am using Borland Turbo C++ with some inlined assembler code, so presumably Turbo Assembler (TASM) style assembly code. I wish to do the following:

void foo         


        
12条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-05 03:38

    A couple more things (shots in the dark) to try:

    • see if using the following assembly instruction helps:

      mov eax, offset SomeLabel
      
    • most compilers can produce an assembly listing of the code they generate (not sure if Turbo C++ can, since Codegear/Embarcadero position it as a free, non-professional compiler).

      Try producing a listing with C code that has an uses a label (as a goto target for example), with some inline assembly in the same function - but don't try to access the label from the assembly. This is so you can get a compiler with no errors and an assembly listing. Something like:

      int foo()
      {
          int x = 3;
          printf( "x =%d\n", x);
          goto SomeLabel;
                                 //
          __asm {
              mov eax, 0x01
          }
                                 //
      SomeLabel:
          printf( "x =%d\n", x);
                                 //
          return x;
      }
      

      Look at the assembly listing and see if the generated assembly decorates the label name in a way that you might be able to replicate in the inline assembly.

提交回复
热议问题