I am relatively new to all this low level stuff,assembly language.. and want to learn more detail. Why there is a difference between Linux, Windows Assembly languages?
In addition to other answers.
OS dictates its Application Binary Interface (ABI), which includes format of executable objects. These are Executable and Linkable Format (ELF) for Linux (and many other Unix-like systems), and Portable Executable (PE) on Windows. See this table for other formats.
Assembly language is related to CPU architecture not with O.S., but O.S. have a series of system function compiled in binary that your assembly program can invoke, by interrupt calling. For example standard input output , operation ecc....
Historically Linux assembly tends to be done using AT&T syntax, since this is what the GNU Assembler supports. Likewise, Windows assemblers tend to use the Intel syntax, as with MASM and NASM.
All x86 assemblers produce the same output -- that is, x86 machine code. And you can use NASM or the GNU Assembler on Linux to program under Intel syntax, and the GNU Assembler on Windows to program under AT&T syntax.
There is no difference. The assembly code is the same if the processor is the same. x86 code compiled on Windows is binary compatible with x86 code on Linux. The compiler does not produce OS-dependent binary code, but it may package the code in a different format (e.g. PE vs. ELF).
The difference is in which libraries are used. In order to use OS stuff (I/O for example) you must link against the operating system's libraries. Unsurprisingly, Windows system libraries are not available on a Linux machine (unless you have Wine of course) and vice-versa.
The OS determines two things: (1) the calling convention, which defines how parameters go on the stack and therefore impacts the assembly code, and (2) the run-time libraries that implement common functions like memory allocation, input/output, higher-level math, etc.
So while x+y
compiles to the same assembly code under Windows or Linux on an x86 processor, y = sin(x)
will be different due to a different calling convention and different math library.
Beyond that, the assembly language itself is dependent on the processor. x86, x86_64, ARM, PowerPC, each have their own assembly language.
There's no difference in the assembly languages (although there may be differences between assemblers, and hence the notations used), provided we're sticking to x86. Both Linux and Microsoft Windows do run on other architectures, more so in the case of Linux.
However, an operating system nowadays doesn't just load a program into memory and let it go. It provides a large amount of services. Since it also protects programs from each other, it imposes restrictions. To do anything other than basic computation, it is usually necessary to go through the operating system. (This was less true of older operating systems, like MS-DOS and CP/M, which could load programs that would run independently, but nowadays pretty much every non-embedded system has a modern OS.)
Nor are programs stored as plain binary blobs. It's normally necessary to link with other libraries, often as the program is loaded for execution (that's how DLLs work, for example), and it is necessary to link with the OS. There may be other information the OS requires, and therefore there has to be some sort of information about the binary blob in the executable file. This varies between OSes.
Therefore, executable files have to be in a format to be loaded into memory, and this varies from OS to OS. To do anything useful, they have to make OS calls, which are different between systems. That's why you can't take a Windows executable and associated libraries and run it on Linux.