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,733 of 4,675    |
|    Bogdan (bogdro) to NimbUs    |
|    Re: interfacing ASM (ia-32) with GNU g77    |
|    27 Jun 17 18:03:21    |
   
   From: bogdan@nospicedham.poczta.gazeta.pl   
      
   On 26.06.2017 21:09, NimbUs wrote:   
   > Bogdan (bogdro) wrote as news:594e3b87$0$647$65785112   
   > @news.neostrada.pl:   
   >   
   > Dzien' dobry !   
      
   Wow! I didn't expect that. A good morning / good afternoon (depending   
   on when you're reading this) to you too :)   
      
   [...]   
      
      
   > I tested the NASM + g77 combo on the example 'asmfl' which you   
   > kindly provided (with helpful comments). On my windows XP 32-   
   > bits installation, the example compiled and ran successfully   
   > after making two minor modifications, which I am documenting   
   > here, with comments for the sake of people who might search   
   > the news groups archive, some time in the future.   
   >   
   > *Mod 1. : For some reason, on this Windows platform, external   
   > names imported by Fortran (g77) want to be ENCLOSED in _2_   
   > underscores, thus '_sum_' in your here modified ASM example :   
   >   
   > ; NASM - asm1fl.asm   
   > section .text use32   
   > global _sum_   
   >   
   > _sum_: ; note two _underscores_   
      
      
    Now this is interesting indeed. This is most probably OS-dependent.   
   For example, Linux doesn't decorate C names, so "printf" in source   
   code is just a "printf" in binary, but on DOS or Windows, it's   
   "_printf". I may need to update my tutorial. Could you just tell me   
   what Fortran's "MAIN" looks like in the binary? Is it "_MAIN__" (1   
   underscore before, 2 underscores after)? A tool like "nm" can help   
   you, or just make your g77 produce assembly output ("g77 -S" or   
   similar). I don't have a Windows build environment set up.   
      
      
   > *Mod. 2 : The object format expected by g77 on the platform is   
   > coff, not ELF, so I had to change the assembler command line   
   > to : 'nasm -f coff asm1fl.asm' .   
      
    Yes. For DJGPP on DOS it also would be COFF, for 16-bit compilers it   
   would be OMF, but I don't know if GNU compilers are ported to 16 bit   
   somewhere, so no need to worry about this, just a side note.   
      
   [...]   
      
   --   
   Pozdrawiam/Regards - Bogdan (GNU/Linux & FreeDOS)   
   Kurs asemblera x86 (DOS, GNU/Linux): http://bogdro.evai.pl   
   Grupy dyskusyjne o asm: pl.comp.lang.asm alt.pl.asm alt.pl.asm.win32   
   www.Xiph.org www.TorProject.org Soft(EN): http://bogdro.evai.pl/soft   
      
   --- 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