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,723 of 4,675    |
|    Frank Kotler to NimbUs    |
|    Re: interfacing ASM (ia-32) with GNU g77    |
|    26 Jun 17 19:14:14    |
      From: fbkotler@nospicedham.myfairpoint.net              NimbUs wrote:              ...       > Regarding the problem you found with g77, it's because you       > must declare the size of integers /in the Fortran text/, e.g.       > as : 'implicit integer (I-N)'. The compiler options which you       > used when calling gfortran have no effect w/ g77.              Well, just for completeness... The Fortran code is not mine. Got it off       the Forum.               program testassembly        implicit none        integer*8 summ,a,b        a=2000000000        b=2000000000        write(6,*)summ(a,b)        end              The poster was trying to link against 64-bit code (as I recall he was       getting a segfault). This is my 32-bit version.              section .text       global summ_ ; leading underscore too for Windows              summ_:        push ebp        mov ebp, esp               mov eax, [ebp + 8] ; address of first parameter        mov ecx, [ebp + 12] ; address of second parameter        mov ebx, [eax+4] ; first parameter        mov eax, [eax]        mov edx, [ecx+4] ; second parameter        mov ecx, [ecx]        add eax, ecx ; add 'em up        adc edx, ebx       return result in edx:eax?               mov esp, ebp        pop ebp        ret              I assemble the .asm file first, then "g77 callsum.f summ.o -o callsum"       (no Makefile for this). As you can see, the .asm file "expects" 64 bits       and attempts to return 64 bits. This "seems to work" but g77 complains       if I use a larger integer. Perhaps "implicit none" is a problem? I don't       even know how to comment it out!              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