Click to See Complete Forum and Search --> : compiling *.asm file under Mandrake HOWTO?


vpv
03-15-2004, 11:26 AM
Well, I have this 'prog.asm' file written in MASM6.1 for DOS and I want to compile it under Linux Mandrake 9.2. Is there any way to do this :confused: ? What is it? Is this a stupid question :rolleyes: ?
Thanx a bunch for the help in advance.
Regards,

vpv

Seko
03-15-2004, 12:24 PM
you can not compile a dos asm file in linux i think

the mitzman
03-15-2004, 12:40 PM
actually, you should be able to because asm (assembler is machine architecture dependant). In asm, you're not working with high level OS api's, you're working straight with the hardware registers and other low level hardware goodies.

I don't know what assembler you should use, but it should be ok under either opsys.

bwkaz
03-15-2004, 09:00 PM
But in order to get anything interesting done (including input and output, unless your DOS program uses BIOS calls, which won't work in Linux because the kernel controls the hardware...), you need to use OS-provided functionality. DOS uses interrupt 21 hex for most of those (though not all). Linux uses interrupt 80 hex for everything.

Your DOS program will not work if it relies on any DOS system calls.

Think of it this way -- if assembly was portable to Linux because the processor is the same, then Windows binaries would be able to run with nothing more than a file format changer to convert from PE to ELF. Assembly language is isomorphic to machine code -- every assembly instruction is equivalent to one (or, with macros, a small set of) binary opcodes.

Obviously that's not the case (or the job of Wine would be a heck of a lot different).

Not to mention that MASM uses Microsoft syntax, and I don't know of anything on Linux that uses that syntax for sure. Most assemblers (including gas, the assembler that gcc uses to create object files) use AT&T syntax, which is quite different.