Pergunta

I understand that there are many versions of the assembly programming language, such as x86, ARM, MIPS, Motorola, etc... which run on various architectures. However, why is this? How does assembly work? Why is it that I can't use one version of assembly on a different architecture. On the simplest level, surely we're just dealing with the flow of electric current, so why is there this kind of restriction, and how do these architectures even differ?

Furthermore, let's say I wanted to make an operating system that run on a custom architecture - one that I made. Would I then have to create my own assembly language? And is assembly language required anyway for creating an OS?

Foi útil?

Solução

assembly language is for the most part just a human readable/managable form of machine code. the processors run on machine code, bits and bytes. for many various reasons different processor families made by different companies are different. Just like not all cars are identical. One way the processors are different is because they operate on different instruction sets, different machine code, different combinations of ones and zeros. As a result of that the assembly language from one to the other varies as well. Further, the assembly languages are often defined by the processor creator, the individuals/company that designed the processor (not always the case, but often). And just like they make different processors they have different habits and desires for the assembly language syntax and other choices. So another reason for the assembly languages to vary. Just like not all cars use the same size tires.

Outras dicas

Every computer architecture "speaks" their own language. Assembly is more or less a one-to-one mapping of machine language into human language. Because machine languages are different, so are assemblies.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top