COAL Lab Manual 3
COAL Lab Manual 3
Lab 03
Topic 1. Direct Addressing Mode with variations.
PART 1
Types of Registers:-
The registers are grouped into three categories:-
1. General Purpose registers
1.1. Data registers
1.1.1. AX is the primary accumulator.
1.1.2. BX is known as the base register.
1.1.3. CX is known as the count register.
1.1.4. DX is known as the data register.
1.2. Pointer registers
1.2.1.Instruction Pointer IP
1.2.2. Stack Pointer SP
1.2.3. Base Pointer BP
1.3. Index registers
1.3.1. Source Index SI
1.3.2. Destination Index DI
2. Control registers
2.1. Instruction Pointer and Flag register
3. Segment registers
3.1. Code Segment CS
3.2. Data Segment DS
3.3. Stack Segment SS
3.4. Extra Segment ES
Types of variables
Byte 8 Num1: db 43
Word=> 2 bytes 16 Num2: dw 0xABFF
double word=> 2 words 32 Num3: dd 0xABCDEF56
Note: size of both operands must be same for any type of instruction.
For example:
Mov ax,dh ;is wrong because destination is 2 bytes and source is 1 byte.
Areas highlighted in red( memory 1) “m1” and blue (memory 2) “m2” are showing
the memory contents. Note: Two copies of the same memory is displayed in the
given windows.
Area highlighted with yellow is showing the ascii values of the contents displayed
in the memory m2.
Viewing sample variable in memory.
Execute every part of Question 1 in Nasm with Dosbox and observe the memory
variables and register values.
Example 1.
Example 2
Example 3
Practice Tasks
Write a program to solve the following:
Save the sum of these (using Direct addressing mode) Five variables (Var1+
Var2+ Var3+ Var4+Var5) in ax.