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,697 of 4,675    |
|    NimbUs to All    |
|    Re: interfacing ASM (ia-32) with GNU g77    |
|    23 Jun 17 21:22:31    |
   
   From: nimbus@nospicedham.XXX.invalid   
      
   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.   
   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.   
      
      
   > Thank you,   
   Tthank you, Rick !   
      
   --   
   NimbUs   
      
   --- 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