Assembly tutorial 1
- Macros are basically a text substitution mechanism.
- The registers inside the 8086 are all 16 bits. They are split up into four categories: General
Purpose, Index, Status & Control, and Segment.
- Out of eight four general purpose registers are the AX, BX, CX, and DX registers.
o AX - accumulator, and preferred for most operations.
o BX - base register, typically used to hold the address of a procedure or variable.
o CX - count register, typically used for looping.
o DX - data register, typically used for multiplication and division.
- the main purpose of a register is to keep a number (variable)
- because registers are located inside the cpu, they are much faster than
memory. accessing a memory location requires the use of a system bus, so it
takes much longer. accessing data in a register usually takes no time.
therefore, you should try to keep variables in the registers. register sets are
very small and most registers have special purposes which limit their use as
variables, but they are still an excellent place to store temporary data of
calculations.
- Assume that DS = 100, BX = 30, SI = 70.
The following addressing mode: [BX + SI] + 25
is calculated by processor to this physical address: 100 * 16 + 30 + 70 + 25 =
1725.
- if zero is added to a decimal number it is multiplied by 10,
however 10h = 16, so if zero is added to a hexadecimal value, it is
multiplied by 16, for example:
7h = 7
70h = 112
- the value in segment register (CS, DS, SS, ES) is called a segment,
and the value in purpose register (BX, SI, DI, BP) is called an offset.
- Immediate addressing mode
- The addressing mode in which the data operand is a part of the instruction itself is
known as
- immediate addressing mode.
There are three basic types of operands:
• Immediate—uses a numeric literal expression
• Register—uses a named register in the CPU
• Memory—references a memory location