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,705 of 4,675    |
|    Frank Kotler to Frank Kotler    |
|    Re: interfacing ASM (ia-32) with GNU g77    |
|    24 Jun 17 14:45:28    |
   
   From: fbkotler@nospicedham.myfairpoint.net   
      
   Frank Kotler wrote:   
      
   ...   
   > I do have some code from back in the days when the forum was on   
   > SourceForge. It links against "gfortran" - no "77". Much like linking   
   > against C. ("gcc" is the "gnu compiler collection" and "gfortran" is one   
   > of the compilers - other implementations may differ). I can post it if   
   > you want, but I doubt if it'll be much help...   
      
   In view of the fact that you don't seem to be getting much help even on   
   the Fasm board, I'll post what I've got. It might be better than   
   nothing. I cannot vouch for the correctness of this code. It "seems to   
   work"...   
      
   The Makefile:   
      
   callequals: callequals.o equals.o   
    gfortran callequals.o equals.o -o callequals   
      
   callequals.o: callequals.f   
    gfortran -c -fdefault-integer-8 -fdefault-real-8 -fno-range-check   
   callequals.f -o callequals.o   
      
   equals.o: equals.asm   
    nasm -f elf equals.asm -o equals.o   
      
   The gfortran caller (not 77):   
      
    m = 1024   
    n = 1023   
    print 5, equal(m,n)   
    n = 1024   
    print 5, equal(m,n)   
    5 format(z20)   
    end   
      
   The (N)asm file - other assemblers should be similar:   
      
   global equal_   
      
   section .text ;return 0 only if two (64-bit) parameters are equal   
      
   equal_:   
      
    push ebp   
    mov ebp, esp   
    mov eax, [ebp+8] ;eax <- addr of 1st param   
    mov ecx, [ebp+12] ;ecx <- addr of 2nd param   
    pop ebp   
   fld qword [eax]   
    mov edx, [eax+4] ;edx <- hi dword of 1st param   
    mov eax, [eax] ;eax <- lo dword of 1st param   
    xor eax, [ecx] ;xor 1st and 2nd params   
    xor edx, [ecx+4]   
    push edx   
    push eax   
    fld qword [esp]   
    add esp, 8   
      
    ret   
      
      
   Good luck!   
      
   Best,   
   Frank   
      
   --- 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