OCR Computing A-Level Revision

Assembly, Object, and Machine Code (3.2.b, 3.2.c)

Assembly code is very similar to the computer's own machine code. Instead of writing actual machine code (which would probably need to be entered in either binary or hex), assembly language uses descriptive terms for data stores and mnemonics for commands.

An assembler then "assembles" the program from assembly language into machine code. One assembly language instruction is translated into one machine code instruction. A symbol table is created to match labels to addresses. Finally, the syntax is checked, and diagnostics are offered for errors (if any).

Machine Code (Object Code)

Machine code consists of all the possible instructions for a particular processor. The code is often very hard for humans to understand and write without mistakes, because it is encoded in binary.

Comparison

  Machine code Assembly language High level language
Uses mnemonics   x  
Uses only binary (or hexadecimal) code x    
May use relative addresses   x  
May use local variables     x
Needs translation before the program can be executed   x x
May be translated into intermediate code     x