Industrial Training




Operation code and operand



An opcode (operation code) is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question (which may be a general CPU or a more specialized processing unit).

An operand is a quantity on which an operation is performed

Offest-->The distance from a starting point, either the start of a file or the start of a memory address. Its value is added to a base value to derive the actual value. An offset into a file is simply the character location within that file, usually starting with 0; thus "offset 240" is actually the 241st byte in the file.

When a processor is executing a program, the program is in a machine language. However, programmers almost never write their programs directly into this form. While it may not have been originally written in this way, it is translated to a machine language at some point before execution so that it is understandable by the CPU. Machine language can be directly interpreted by the hardware itself, and is able to be easily encoded as a string of binary bits and sent easily via electrical signals.

The instruction set is a collection of pre-defined machine codes, which the CPU is designed to expect and be able to act upon when detected. Different processors have different instruction sets, to allow for greater features, easier coding, and to cope with changes in the actual architecture of the processor itself. Each machine code of an instruction set consists of two seperate fields:



Opcode     Operand(s)

The opcode is a short code which indicates what operation is expected to be performed. Each operation has a unique opcode. The operand, or operands, indicate where the data required for the operation can be found and how it can be accessed (the addressing mode, which is discussed in full later). The length of a machine code can vary - common lengths vary from one to twelve bytes in size.

The exact format of the machine codes is again CPU dependant. For the purpose of this tutorial, we will presume we are using a 24-bit CPU. This means that the minimum length of the machine codes used here should be 24 binary bits, which in this instance are split as shown in the table below:





Opcodes are also given mnemonics (short names) so that they can be easily referred to in code listings and similar documentation. For example, an instruction to store the contents of the accumulator in a given memory address could be given the binary opcode 000001, which may then be referred to using the mnemonic STA (short for STore Accumulator).



The most common fields found in instruction format are:-

  1. An operation code field that specified the operation to be performed
  2. An address field that designates a memory address or a processor registers.
  3. A mode field that specifies the way the operand or the effective address is determined.


Computers may have instructions of several different lengths containing varying number of addresses. The number of address field in the instruction format of a computer depends on the internal organization of its registers. Most computers fall into one of three types of CPU organization.


  1. Single Accumulator organization ADD X AC ® AC + M [×]
  2. General Register Organization ADD R1, R2, R3 R ® R2 + R3
  3. Stack Organization


Hi I am Pluto.