You are on page 1of 7

LAB REPORT 05

µP Interfacing and Programming Lab

ROLL NO: 20L-1447 SECTION: 5A2

ASHAR MUSHTAQ DEPARTMENT: BSEE

EXPERIMENT 05
STRINGS IMPLEMENTATION IN EMU8086

INTRODUCTION
In this lab of course, we have been introduced with different program control flow instructions in
8086 microprocessors.

String is a series of data byte or word available in memory at consecutive locations. It is either
referred as byte string or word string. Their memory is always allocated in a sequential order.
Instructions used to manipulate strings are called string manipulation instructions.

These instructions are used to copy a block of bytes/words from one location in memory to
another. The source is pointed to by DS:SI and the destination is pointed to by ES:DI.

MOVSB Move byte DS:[(E)SI] to ES:[(E)DI]

MOVSW Move word DS:[(E)SI] to ES:[(E)DI]

MOVSD Move dword DS:[(E)SI] to ES:[(E)DI]

OBJECTIVES
 To be able to write assembly languages programs for string manipulation in EMU8086
 To understand operations including storing strings in memory, loading strings from
memory, comparing strings, and scanning strings

OBSERVATIONS
In this Lab we wrote and executed an assembly language program Write and execute an
assembly language program to move your first name in data segment 03002+X H and copy the
string saved in first part to extra segment 03008+X H. Then Secondly, we have written an
assembly language code to scan letter “a” in the string stored in question no.1. If the letter” a” is

1|Page
present in the string save the hex value 61 in AX register else save 0. The program should also
find the number of times letter “a” appears in the string. The result of the count should be saved
in register BX.
MEASUREMENTS

Task 1

Part A

MOV DX,0300H

MOV DS,DX

MOV DS:[0000H],'A'

MOV DS:[0001H],'S'

MOV DS:[0002H],'H'

MOV DS:[0003H],'A'

MOV DS:[0004H],'R'

2|Page
Part B

MOV ES,DX

MOV BX,0008H

MOV DI,BX

MOV CX,06H

CLD

COPY:

LODSB

MOV ES:[DI],AL

INC DI

LOOP COPY

3|Page
HLT

TASK 2
MOV DX,0300H

MOV DS,DX

MOV DS:[0000H],'A'

MOV DS:[0001H],'Z'

MOV DS:[0002H],'M'

MOV DS:[0003H],'E'

MOV DS:[0004H],'E'

MOV DS:[0005H],'R'

MOV CX,07H

MOV BX,0000H

ABC:

4|Page
LODSB

CMP AX,0000H

JE EXIT

CMP AL,'A'

JE HEXVALUE

MOV AX,0

LOOP ABC

HEXVALUE:

MOV AX,61H

INC BX

LOOP ABC

EXIT:

HLT

ISSUES
5|Page
Some little difficulties were faced while understanding the concept but later on it has been
resolved and went smoothly.

APPLICATIONS
Emu8086 combines an advanced source editor, assembler, disassembler, software emulator
(Virtual PC) with debugger, and step by step tutorials. This program is extremely helpful for
those who just begin to study assembly language. It compiles the source code and executes it on
emulator step by step.

CONCLUSION
We learned the instruction set of 8086 microprocessors like data transfer instruction, logical
instruction, arithmetic instruction and branching instruction. Addressing mode tells us what is the
type of the operand and the way they are accessed from the memory for execution of an
instruction and how to fetch particular instruction from the memory.

POST LAB
TASK 1

MOV DX,0300H

MOV DS,DX

MOV DS:[0000H],'A'

MOV DS:[0001H],'S'

MOV DS:[0002H],'H'

MOV DS:[0003H],'A'

MOV DS:[0004H],'R'

MOV CX,0FFFFH

MOV BX,0000H

ABC:

LODSB

6|Page
CMP AX,0000H

JE EXIT

INC BX ;BX has the lenght of String

LOOP ABC

EXIT:

HLT

-------END------

7|Page

You might also like