80x86 asm in Windows; shouldn't it work on Linux?
The title says it. If Windows and Linux both work on the same CPUs, or at least most of them, shouldn''t x86 coded programs work on both OSs? I can see why it wouldn''t work on Mac (all around different hardware), but Linux?
The OS, API''s, libraries, and binary file formats are all completely different. If you can support all of those things (e.g. WINE), then yes, you can run Windows programs on Linux, but otherwise, it''s simply not possible.
~~~~~~~~~~
Martee
http://www.csc.uvic.ca/~mdill
~~~~~~~~~~
Martee
http://www.csc.uvic.ca/~mdill
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Binary should be the same, but the system calls, storage format, and other somesuch is quite different.
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
Why is it called a hot water heater? Isn't it cold when it goes in the tank?
[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
Sounds like it''d be possible to make a Win32/X app in assembler then. (maybe protected mode DOS and/or Be too)
See?! It''s not completely unportable! :D
See?! It''s not completely unportable! :D
"There is only one everything"
Another aspect that you don''t have mentioned, possibily you know it, is the assembler files format.
Linux assemblers (as or gcc inline assembly) use a different format (AT&T) for the instructions. So the typical source code for Windows systems doesn''t works directly with that assembler (they''re really the same).
You can convert the code (there are programs that do it automatically, but not very well) or use NASM wich is similar to the Windows assemblers and is multiplatform.
Linux assemblers (as or gcc inline assembly) use a different format (AT&T) for the instructions. So the typical source code for Windows systems doesn''t works directly with that assembler (they''re really the same).
You can convert the code (there are programs that do it automatically, but not very well) or use NASM wich is similar to the Windows assemblers and is multiplatform.
The question was: Shouldn''t ASM in Windows actually work on Linux? What''s not to understand?
May 04, 2001 12:11 PM
As an earlier poster said, you can''t run executables from other OSes on Linux without some kind of translator/emulator (of which there are several, WINE, Win4Lin, VMWare, Plex86 etc.).
However, if you are writing an application, and want to use assembler routines, its quite doable.
Since the Linux assembler uses AT&T syntax (mov src,dest and other changes) you either have to use gas under Windows (ala Cygwin) or even better is use the NASM assembler under Windows and Linux.
Nasm is a portable assembler (with source) that will compile x86 code for several operating systems (and uses the more typical Intel assembler syntax: mov dest,source).
If you want to do cross platform game development (2D or OpenGL) I suggest you look into SDL (http://www.libsdl.org). Its very nice to use for low-level (fast) cross platform support. I believe it currently supports Linux/Unix (X, framebuffer), Windows, BeOS, Mac etc.
Enjoy.
However, if you are writing an application, and want to use assembler routines, its quite doable.
Since the Linux assembler uses AT&T syntax (mov src,dest and other changes) you either have to use gas under Windows (ala Cygwin) or even better is use the NASM assembler under Windows and Linux.
Nasm is a portable assembler (with source) that will compile x86 code for several operating systems (and uses the more typical Intel assembler syntax: mov dest,source).
If you want to do cross platform game development (2D or OpenGL) I suggest you look into SDL (http://www.libsdl.org). Its very nice to use for low-level (fast) cross platform support. I believe it currently supports Linux/Unix (X, framebuffer), Windows, BeOS, Mac etc.
Enjoy.
hey, no need to just make the assumption that assembly will work on both os''s - ALL compiled code could....
but the thing is, the os''s have diffrent ways of loading the code into memory, the startupcode for all processes and of course different systemcalls and maybe diffrent ways of parameter passing, but of course, it runs on the same hardware and the instructionset MUST be the same so as long as you convert the startupcode as mentioned earlier and also the systemcalls well then it''s a piece of cake (WIN4LIN)....
If you are really intrested in writing code to work on a lot of systems, take a look at POSIX standard....
but the thing is, the os''s have diffrent ways of loading the code into memory, the startupcode for all processes and of course different systemcalls and maybe diffrent ways of parameter passing, but of course, it runs on the same hardware and the instructionset MUST be the same so as long as you convert the startupcode as mentioned earlier and also the systemcalls well then it''s a piece of cake (WIN4LIN)....
If you are really intrested in writing code to work on a lot of systems, take a look at POSIX standard....
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I'm looking for work
Let me give you a simple answer. Since you were talking about assembly language, you''re not talking about binaries, so you can forget about WINE and all of that--those are unnecessary. All you need to do to make your ASM work on both platforms is to make sure that it doesn''t call anything OS-specific. So, as long as, say, you never call Win32''s GetProcAddress or something in a Win32 run-time library, you''re perfectly fine. Of course, yes, you''ll have to make separate binaries, but those chunks of assembly are 100% portable--ignoring potential syntax difference (Intel vs. AT&T ASM syntax).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement