Conditonal Assembly in Nasm

From: Axel Schlicht (axel.schlicht_at_mail.isis.de)
Date: 05/26/04


Date: Wed, 26 May 2004 17:57:43 +0000 (UTC)

Hi folks.

Does anybody know if nasm supports _OS-depending_ assembly like:

let's assume a C-program calls a function func.
Under Linux it will call func but under DOS it will call _func.
So it would be nice to map bot possibilities to one as in
        %if running_under_linux
          global func
        %else
          global _func
        %endif

        .... and later in the prog

        %if running_under_linux
          call func
        %else
          call _func
        %endif

or even

        %if running_under_linux
          define Func func
        %else
          define Func _func
        %endif

        ... and later in the program
        call Func

Would make using nasm under DOS (aka Windows 9x) and Linux much
easier.

So how can nasm determine which OS it is being used under and compile
correspondingly?
Thanks a lot for helping

Axel Schlicht



Relevant Pages

  • Re: New to Debian Linux - I have NASM experience under DOS 6.22
    ... > simple NASM program under Linux. ... > whether there is a more official or reliable way to make a NASM ... Windows automatically including the "current directory" in the ... directory" is NOT part of that PATH as it is with DOS... ...
    (alt.lang.asm)
  • Re: Conditonal Assembly in Nasm
    ... > Under Linux it will call func but under DOS it will call _func. ... It's possible to write an executable that runs both as a dos .com file ... (dos executes the ELF header without doing ...
    (comp.lang.asm.x86)
  • Re: Disk I/O, BIOS, dosemu, FreeDOS, linux host with Virtual Machines
    ... VirtualBox guest VM on a Linux host - I'm not sure how VirtualBox will ... Not running dos doesn't rule it out entirely. ... If you wanted to make this transition "stepwise", you could start using Nasm for some dos projects that you've already got working in Masmese, and make the transition to Linux when you're comfortable with Nasm. ... As you get into something more "advanced" it gets more complicated - but this would also be true of Windows, or even dos... ...
    (comp.lang.asm.x86)
  • Re: NASM in DOSEMU
    ... > Linux, but I wonder if NASM for DOS works in DOSEMU. ... You don't need a special NASM version for DOSEMU. ...
    (alt.lang.asm)
  • Re: Assembly Programming Book (not for "Dummies" or Intro)
    ... > with DOS and Linux", Jeff Duntemann, it is a good book, but I want something ... It uses NASM. ...
    (comp.lang.asm.x86)