- Label
- Op Code
- Operands
- Comments
Assemblylanguage is intimately tied up with addressing modes. These are related to physical attributes like the registers available and the word length. The most common addressing modes are:
- Register addressing - If data is transferred from a source register to a destination register
- Immediate addressing - This is where the data appears immediately after the opcode, as part of the instruction.
- Direct addressing - Refers directly to a specific memory location
- Indirect addressing - Uses a number inside a register (usually an index register) to point to the memory location of interest where the actualdata can be found
- Indexed addressing - A number contained in one register is usually used in combination with the number in another register to point to the actual memory location where the data is stored.
Locical operations
the 'and' function - An output of 1 is only produced when the inputs on both registers are 1
the 'or' function - An output of 1 is only produced if one input OR the other input OR both inputs are 1.
Masking - When using the logical 'and' and 'or' functions, we can create a mask which either lets a pattern of bits through, or blocks them.
the 'xor' function - An output of 1 is only produced if one input OR the other input and not if both inputs are 1 or 0.
the 'not' function - The bits are inverted meaning that any bits in inputed as 0 will be outputed as 1 and vise versa.
Shift operations
arithmetical shift (left or right) - This type of shift preserves the sign of the number. with the rules of binary a shift to the right would multiply a number by 2 and a shift to the left would divide the number by 2. However if two's complement is used then the sign must be preserved, or negative numbers may change into positive numbers and vice versa when these multiplication or division operations are being carried out. The sign bit must therefore be preserved, and this is the difference between a logical shift(which does not preserve the sign) and an arithmetical shift(which does).
Rotate instructions - this allows you to look at numbers which are too big to be contained in a single register. Instead of digits "falling off"the end, they are directed round the path shown by the arrows and redirected into the other end of the register.
instructions required to divert the flow of the program to different parts depending on the state of some particular condition is known as jump instructions and is essential and important for assmbly language.
The assembler
An assembler is software that converts the assembly language mnemonics into machine code ready for execution on the target machine. Without an assembler you would have to translate each assembly language mnemonic into machine code by hand.
The assembly language language mnemonics would normally hav to be written using a text editor. The listings of the assembly language mnemonics is called the source code or the source program. After the assembly process has been carried out, we end up with the machine code program which is called the object code or the object program.
The main features of a typical assembler