Cards (10)

  • As with everything inside a computer, processors can only understand instructions given in binary. These binary instructions are called machine code.
  • Machine code is the only type of programming language that does not need to be translated before being run, because it is written in binary. All other programming languages must first be translated into machine code instructions before a processor can execute them.
  • Writing in machine code is very difficult for humans, as it is hard to read and write a program that consists of just 0s and 1s. It is also very difficult for humans to debug and fix problems in machine code.
  • Where it is necessary for humans to see and interact with machine code, hexadecimal is usually used to represent the binary digits, because hexadecimal is easier for humans to read and understand.
  • Each low-level instruction consists of two parts: an opcode and an operand.
  • An opcode (sometimes also referred to as an operation code) is the part of the instruction that specifies which operation the processor should perform. For example, an opcode might specify the loading or storing of data.
  • The operand contains a value, or set of values, relevant to the opcode. The operand can be an actual piece of data, or it can be a reference to the memory location of the data for the opcode to act on. For example, when the opcode is a 'store' instruction, the operand contains the memory location where the data should be stored.
  • In machine code, an addressing mode is specified as part of the opcode of an instruction. The addressing mode specifies the way in which the operand will be interpreted. For example, the operand could be an actual data value or it could be a reference to a memory location.
  • In the same way as a binary code is used to represent the operation, a code is also used to represent the addressing mode. So, if the code 01 represents immediate addressing, the operand is interpreted as a data value.
  • A different code, for example 10 could be used to indicate direct addressing. In this mode the operand is treated as a memory address.