home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,698 of 4,675   
   Rick C. Hodgin to NimbUs   
   Re: interfacing ASM (ia-32) with GNU g77   
   23 Jun 17 14:32:12   
   
   From: rick.c.hodgin@nospicedham.gmail.com   
      
   On Friday, June 23, 2017 at 5:24:56 PM UTC-4, NimbUs wrote:   
   > Rick C. Hodgin dit dans news:0d9a6c71-61b1-46fc-91d8-   
   > be361f7159a5@googlegroups.com:   
   > (NimbUs's question)   
   > >> I need guidance and, if possible, a template for writing a   
   > >> "subroutine" callable from GNU Fortran - specifically, g77.   
   > >> Let's say, having a couple of long integer (integer*8)   
   > >> parameters.   
   > (.....)   
   > > You can use Visual Studio to write your assembler code if   
   > you   
   > > want.  That way you have the full debugger IDE to help you   
   > debug   
   > > your call into the assembly function, examine the call   
   > stack,   
   > > parameter order, etc., and make sure everything's working.   
   > >   
   > > It supports assembly using:   
   >   
   > >     _asm {   
   > >         // Put your assembly here   
   > >     }   
   > >   
   > > You can also use a standard calling convention for your call   
   > > into the code, receiving parameters, and returning them   
   > using   
   > > a traditional C template, as in:   
   > >   
   > >     int my_add_function(int p1, int p2)   
   > >     {   
   > >         int result;   
   > >   
   > >         _asm {   
   > >             // All your custom code goes here   
   > >             // Note:  That the 64-bit calling convention   
   > places   
   > >             //        the first parameters in registers, so   
   > you   
   > >             //        can directly access them   
   > >   
   > >             // Add them   
   > >             add   rcx, rdx   
   > >   
   > >             // Store the result   
   > >             mov   result,rcx   
   > >         }   
   > >   
   > >         return(result);   
   > >     }   
   > >   
   > > It adds some overhead, but sometimes it's easier to code and   
   > > debug.   
   >   
   > I see your point. But... I don't do MS "visual" things, and I   
   > hate the idea of adding a steam hammer just to smash a fly.   
      
   Visual Studio is just the IDE.  The whole purpose of Visual Studio   
   is to give you a powerful tool to create your code.  The actual   
   code you create goes in to the DLL or LIB or whatever you're   
   creating that will interface with the other thing.   
      
   > GNU g77 is what I've installed, for no special reason except   
   > I'm familiar (or used to be) with /old/ FORTAN dialects .   
   > well, it happens "g77" does NOT do inline ASM. Oh, I'm on   
   > ia32, not amd64 btw.   
      
   I noticed that just as I clicked the "Post" button.  My apologies.   
   FWIW, what threw me was you sending over 8-byte integers. :-)   
      
   Thank you,   
   Rick C. Hodgin   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca