How do assembly languages depend on operating systems?

前端 未结 7 2023
余生分开走
余生分开走 2020-12-14 04:38

As An assembly language implements a symbolic representation of CPU instructions which are independent on OSes while assemblers are always running under some OS, I was wonde

相关标签:
7条回答
  • 2020-12-14 05:18

    An assembler translates mnemonics (e.g. jump, mov, add, etc.) from an assembly language into machine instructions. Machine instructions are entirely dependent on the hardware (they represent the hardware/CPU instruction set).

    If you ever wanted to come up with an assembly language, you would need to also design/write an assembler that would do the mapping to machine instructions. In that sense if you target a given machine architecture, the assembler should produce machine specific code, not OS specific code. However, the assembler implementation may (and generally is) OS-specific, because of the output program it produces (a Unix executable is not the same as a Windows executable, even though the underlying machine instruction set is x86, for example).

    See here what I mean.

    0 讨论(0)
提交回复
热议问题