You are on page 1of 9

Title: Introduction to Microprocessor 8086, 8086 instructions and programming with 8086.

Abstract:

Main purpose of this experiment was study about emulator EMU8086 and microprocessor
8086.Four codes are implemented with EMU8086 to study its operation. After that it was
complied with MASM software. MASM converts source code to object code. The object code
was introduced to the microprocessor 8086 using MTS-86C.

Introduction:

As an introduction to the 8086 microprocessor the objective of the experiment was :

1. To understand the working principle of MTS-86C and MDA 8086.


2. Get familiarized with emulator EMU8086 by using a simple program to test its different
uses.
3. An introduction to segmented memory technology used by microprocessor 8086.

Equipments:

1. Microprocessor 8086 Trainer Board

2. EMU8086

3. PC having Intel Microprocessor

Precautions:

1. A PC with a standard Anti-Virus program installed should be used.

2. Errors should be avoided when typing source code in a text file.

1. Programs:

The following codes were written down in source code and the MASM software compiled and
gave an output of object code:

P1: Here , AX=1234H ; BX=5678H; CX=1234H ; AX=5678H ; BX=1234H

Object code Source Code


CODE SEGMENT
0000
ASSUME CS:CODE,
DS:CODE
MOV AX,1234H
0000 B8 1234
MOV BX,5678H
0003 BB 5678

MOV CX,AX
0006 8B C8
MOV AX, BX
0008 8B C3
MOV BX,CX
000A 8B D9

HLT
000C F4
CODE ENDS
000D
END
P2: Here ,AX=1234H; BX=5678H

Object code Source Code


CODE SEGMENT
0000
ASSUME CS:CODE,
DS: CODE

MOV AX,1234H
0000 B8 1234
MOV BX,5678H
0003 BB 5678
HLT
000CF4
CODE ENDS
000D
END
P3: Here ,BX=1234H ; CX=5678H ; BX=(1234+5678)H=68ACH

Source Code
Object code
CODE SEGMENT
0000
ASSUME CS:CODE,
DS:CODE

MOV BX,1234H
0000 BB 1234
MOV CX, 5678H
0003 B9 5678
ADD BX,CX
0006 03 D9
HLT
000E F4
CODE ENDS

END
P4: Here ,BX=1234H ; CX=5678H ; CX=(5678-1234)H=4444H

Object code Source Code


CODE SEGMENT
0000
ASSUME CS: CODE,
DS:CODE

MOV BX,1234H
0000 BB 1234
MOV CX, 5678H
0003 B9 5678
SUB CX,BX
0006 2B CB
HLT
000E F4
CODE ENDS
000F
END
P5: Print “Hello World” in assembly.

2. What is the advantage of having overlapping segments in 8086 memory?


Ans: The main advantages of the segmented memory scheme are,
1) Allow the memory capacity to be 1M byte although the actual addresses to be
handled are of 16-bit size.
2) Allow the placing of code data and stack portions of the same program in
different parts (segments) of memory, for data and code protection.
3) Permits a program and/or its data to be put into different areas of memory
each time program is executed, ie, provision for relocation may be done.

3. For a memory location with physical address 1256Ah, Calculate the address in
segment offset from for segments 1256Ah and 1240h.

Ans: Let X be the offset in segment 1256h and Y the offset in segment 1240h. We have:

(a) 1256Ah = 12560h + X  X = 000Ah


Hence, 1256Ah = 1256:000Ah ___ (1)

(b) 1256Ah = 12400h + Y  Y = 016Ah


Hence, 1256Ah = 1240:016Ah ____ (2)
(1) & (2)  1256:000AH = 1240:016AH

 

000Ah

016Ah   1256h

  1240h

4. What are the different data addressing modes available in 8086? Briefly explain
each of them with examples.

Ans: Types of addressing modes:

1. Register mode – In this type of addressing mode both the operands are registers.

Example: MOV AX, BX

XOR AX, DX

ADD AL, BL

2. Immediate mode – In this type of addressing mode the source operand is a 8 bit or 16 bit
data. Destination operand can never be immediate data.

Example: MOV AX, 2000

MOV CL, 0A

ADD AL, 45

AND AX, 0000


Note that to initialize the value of segment register an register is required.

MOV AX, 2000

MOV CS, AX

3. Register indirect mode – In this addressing mode the effective address is in SI, DI or BX.

Example: MOV AX, [DI]

ADD AL, [BX]

MOV AX, [SI]

4. Displacement or direct mode – In this type of addressing mode the effective address is
directly given in the instruction as displacement.

Example: MOV AX, [DISP]

MOV AX, [0500]

5. Based indexed mode – In this the effective address is sum of base register and index
register.
Base register: BX, BP Index register: SI, DI

The physical memory address is calculated according to the base register.

Example: MOV AL, [BP+SI]

MOV AX, [BX+DI]

6. Indexed mode – In this type of addressing mode the effective address is sum of index
register and displacement.

Example: MOV AX, [SI+2000]

MOV AL, [DI+3000]

7. Based mode – In this the effective address is the sum of base register and displacement.

Example: MOV AL, [BP+ 0100]

8. Based indexed displacement mode – In this type of addressing mode the effective address
is the sum of index register, base register and displacement.

Example: MOV AL, [SI+BP+2000]


Conclusion:

All codes are written in microprocessor 8086 and MTS-86C and we got the same results.

You might also like