Tuesday, 6 November 2007

Typical Assembly language instructions :

Using assembly language instructions should be done using typical instructions. With Assembly language, the instructions, the commands are generally straight-forward, such as 'AND', 'OR', 'NOT', and arithmetical instructions as well.

Typical Arithmetical operations (and their Op Codes) :

Addition : Add
Subtraction : Sub
Multiplication : Mul
Division : Div

Addressing Modes

Understanding assembly language is intimatly tied up with addressing modes. These tie to physical attributes like registers available and word length. The most common addressing modes are outlined below :

  • Register Addressing : If data is transferred from a source register to a destination register.
  • Immediate Addressing : Where the data appears immediately after the op code, as part of th instruction.
  • Direct Addressing : When the operand refers to a specific memory location.
  • Indirect Addressing : When the operand takes a specific memory location, and refers it to where actual data can be found.
  • Indexed Addressing : A number contained in one register is combined with another to point to the actual location.

Assembly Language

Assembly language is a second-generation low-level language made up from mnemonics which can be used instead of machine code because it is easier to use. The format of an assembly-language instruction consists of four parts, but the "Label" isn't required.
The four parts are :


  • Label
  • Op Code
  • Operands
  • Comments

An example of these in operation would be :

  • Label - Start:
  • Op Code - mov
  • Operands - bx,80h
  • Comments - ;Load Character Count

The label is used as a reference and is useful when calculating relative jumps, for example. The operation code contains the mnemonic (a mnemonic to MOVe data) which describes the operation being carried out. The operands describe the source and destination of the data to be operated on. The comments are only to help the programmer.