Assembly code vs Machine code vs Object code?

后端 未结 10 2008
执笔经年
执笔经年 2020-11-27 09:11

What is the difference between object code, machine code and assembly code?

Can you give a visual example of their difference?

10条回答
  •  伪装坚强ぢ
    2020-11-27 09:37

    Assembly code is a human readable representation of machine code:

    mov eax, 77
    jmp anywhere
    

    Machine code is pure hexadecimal code:

    5F 3A E3 F1
    

    I assume you mean object code as in an object file. This is a variant of machine code, with a difference that the jumps are sort of parameterized such that a linker can fill them in.

    An assembler is used to convert assembly code into machine code (object code) A linker links several object (and library) files to generate an executable.

    I have once written an assembler program in pure hex (no assembler available) luckily this was way back on the good old (ancient) 6502. But I'm glad there are assemblers for the pentium opcodes.

提交回复
热议问题