You are on page 1of 72

Department of Electronics & Communication Engineering

(School of Electrical, Electronics & Communication Engineering)

Manipal University Jaipur,

Dehmi Kalan, Off Jaipur-Ajmer Expressway, Jaipur, (Raj.)

Rajasthan 303007
LAB RECORD
CONTENTS & EVALUATION REPORT
Student Name: Vasudev Dwivedi Name of Laboratory: Microprocessors & Lab Code: EC2232
Microcontrollers Lab

Registration No.: 199202093 Year: II Sem: IV Sec: B Group No.: B1

S. Experiment Name Page Date of Attendance Record Performance Viva Total Signature
No. No. Allotment (1) (2) (3) (4) (10)
1. Introduction to 8086
2. WALP to add two 8-bit hexadecimal numbers available 1-4 01/03/21
in memory and store the result in the memory
3. WALP to perform subtraction of two 16-bit 5-8 08/03/21
hexadecimal numbers available in memory and store
the result in the memory.
4. WALP for converting an ASCII capital case alphabet 9-12 15/03/21
available in memory into small case alphabet. Store the
result at the same location in memory.
5. WALP to multiply two single ASCII digits available in 13-17 22/03/21
memory and store the result in unpacked BCD form in
memory.
6. WALP to perform division operation using two 8-bit 18-21 05/04/21
hexadecimal numbers available in memory and store
the result in the memory.
7. WALP to find the number of positive and negative data 22-26 12/04/21
elements present in a given array of ten signed
hexadecimal numbers stored in memory. Store the
count of positive and negative numbers in memory
Marks Obtained:
Name of Lab Instructor: Mr. Rohit Mathur Signature of Lab Instructor:

Page 1 of 2
LAB RECORD
CONTENTS & EVALUATION REPORT
Student Name: Vasudev Dwivedi Name of Laboratory: Microprocessors & Lab Code: EC2232
Microcontrollers Lab

Registration No.: 199202093 Year: II Sem: IV Sec: B Group No.: B1

S. Experiment Name Page Date of Attendance Record Performance Viva Total Signature
No. No. Allotment (1) (2) (3) (4) (10)
8. WALP to exchange corresponding elements of two data 27-31 19/04/21
blocks of length 10-bytes stored in memory starting
from 0102H and 010CH respectively. Using WHILE
structure.
9. WALP to search whether the number, 77h, is present in 32-36
the given data block or not. If it is present then, store 26/04/21
“1111h”, otherwise “ffffh” in DX. Using WHILE
structure.
10. WALP to find number of times letter ‘e’ appears in the 37-41 03/05/21
given string, ‘exercise’. Store the count in memory.
Using WHILE structure.
11. WALP to find smallest number from the ten elements 42-46 03/05/21
of a given array of 2-digit hex numbers. Using
SUBROUTINE.
12. Write a program to arrange the elements of a given 47-51 03/05/21
array of 8-bit hexadecimal numbers stored in the
memory in ascending order.

Maximum Marks: Marks Obtained:


Name of Lab Instructor: Mr. Rohit Mathur Signature of Lab Instructor:

Page 2 of 2
EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 2
(ADDITION)

AIM: WALP to add two 8-bit hexadecimal numbers available in memory and store
the result in the memory

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start the program START
Step 2) Initialize two 8-bit data in registers
AL←M1 ; BL→M2
Step 3) Add the data in registers
Step 4) Store the result in some other ADD AL,BL
register M3←AL
Step 5) End the program
STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
org 100h Assembler Directive
07100 EB jmp start Transferred the control to start
07101 04 IF=1
Direct program addressing

07012 36 vec1 36h, 24h, ? , ?


07103 24
07104 00
07105 00

Name: Vasudev Dwivedi Reg. No.: 199202093 1


EC2232
Microprocessors & Microcontrollers Lab

07106 BE lea si, vec1 Addressing mode: immediate


07107 02 Flags Affected: IF=1
07108 01

sum
07109 8A mov al, [si] Addressing mode: indirect register
0710A 04
0710B 46 inc si Flags Affected: IF=1, PF=1
0710C 02 add al, [si] Addressing mode: indirect register
0710D 04 Flags Affected: IF=1, PF=1

0710E 46 ret

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 2


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 3


EC2232
Microprocessors & Microcontrollers Lab

v) STACK Window Screen Shot (if used):

RESULT: Thus, an ALP to add two 8-bit hexadecimal numbers was written and executed
in emu8086.

COMMENTS & i) Registers Used: AX, SI


DISCUSSION:
ii) Total Memory Used: 12 bytes
iii) Total Clock Cycles Used: 35
iv) Alternative instructions: Instructions that would result in same functioning
of the program.
v) Most arithmetic instructions affect the processor status register (or flags)

Name: Vasudev Dwivedi Reg. No.: 199202093 4


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 3
(SUBTRACTION)

AIM: WALP to perform subtraction of two 16-bit hexadecimal numbers available in


memory and store the result in the memory.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start the program START
Step 2) Initialize two 8-bit data in registers
AL←M1 ; BL→M2
Step 3) Subtract the data in registers
Step 4) Store the result in some other register SUB AL,BL

Step 5) End the program M3←AL


STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
org 100h
07100 EB jmp start Transferred the control to start
07101 08 IF=1
Direct program addressing
07012 36 vec1 1336h, 1124h, ?, Flags Affected: IF=1
07103 11 ?
07104 24
07105 11
07106 00 lea si, vec1 Addressing mode: immediate

Name: Vasudev Dwivedi Reg. No.: 199202093 5


EC2232
Microprocessors & Microcontrollers Lab

07107 00 Flags Affected: IF=1


07108 00

Sub
07109 00 mov al, [si] Addressing mode: indirect register
0710A BE Flags Affected: IF=1

0710B 02 inc si Flags Affected: IF=1, PF=1


0710C 01 sub ax,[si] Addressing mode: indirect register
0710D 8B Flags Affected: CF=1, SF=1, IF=1
0710E 04 ret

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 6


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 7


EC2232
Microprocessors & Microcontrollers Lab

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

RESULT: Thus, an ALP to perform subtraction of two 16-bit hexadecimal was written and
executed in emu8086.

COMMENTS & i) Registers Used: AX, SI


DISCUSSION: ii) Total Memory Used: 12 bytes
iii) Total Clock Cycles Used: 35
iv) Alternative instructions: Instructions that would result in same functioning of
the program.
v) Most arithmetic instructions affect the processor status register (or flags)

Name: Vasudev Dwivedi Reg. No.: 199202093 8


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 4
(CASE CONVERSION)

AIM: WALP for converting an ASCII capital case alphabet available in memory into
small case alphabet. Store the result at the same location in memory.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start the program START
Step 2) Load effective address of array in
AL←[SI]
SI reg.
Step 3) move pointed content of SI to AL ADD AL,20h ; INC SI
Step 4) add 20h to AL register content
[SI]←AL
Step 5) increment SI; move AL to SI
STOP
pointed memory
Step 6) end the program

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
org 100h Assembler Directive
07100 EB jmp start Transferred the control to start
07101 02 IF=1
Direct program addressing
07102 41 vec1 ‘A’, ?
07103 00
07104 BE lea si, vec1
07105 02 Addressing mode: immediate
07106 01 Flags Affected: IF=1

Name: Vasudev Dwivedi Reg. No.: 199202093 9


EC2232
Microprocessors & Microcontrollers Lab

07107 8A mov al, [si] Addressing mode: indirect register


07108 04 Flags Affected: IF=1
07109 04 add Flags Affected: IF=1
0710A 20
0710B 46 ret

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

iii)EMULATOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 10


EC2232
Microprocessors & Microcontrollers Lab

iv) FLAGS Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 11


EC2232
Microprocessors & Microcontrollers Lab

v) STACK Window Screen Shot (if used):

RESULT: Thus, an ALP for converting an ASCII capital case alphabet available in
memory into small case alphabet was written and executed in emu8086

COMMENTS & i) Registers Used: AX, SI


DISCUSSION: ii) Total Memory Used: 10 bytes
iii) Total Clock Cycles Used: 32
iv) Alternative instructions: Instructions that would result in same functioning
of the program.
v) Adding 20h converts uppercase letter to lower case letter.

Name: Vasudev Dwivedi Reg. No.: 199202093 12


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 5
(MULTIPLICATION)

AIM: WALP to multiply two single ASCII digits available in memory and store the
result in unpacked BCD form in memory.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start the program START
Step 2) Load data in AL
Step 3) Load data in BL AL←M1, BL←M2
Step 4) Multiply AL and BL
MUL AL, BL
Step 5) End the program

STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
org 100h Assembler Directive
07100 EB jmp start Transferred the control to start
07101 04 IF=1
Direct program addressing
07102 32 vec1 '2','8', ?, ?
07103 38
07104 00
07105 00
07106 BE lea si,vec1 Addressing Mode: immediate
07107 02 Flags Affected: IF=1
07108 01
MULTI

Name: Vasudev Dwivedi Reg. No.: 199202093 13


EC2232
Microprocessors & Microcontrollers Lab

07109 8A MOV AL,[SI] Addressing Mode: indirect


0710A 04 Flags Affected: IF=1

0710B 2C SUB AL,30h Addressing Mode: immediate


0710C 30 Flags Affected: IF=1

0710D 46 INC SI Flags Affected: IF=1, PF=1


0710E 8A MOV BL,[SI] Addressing Mode: indirect
0710F 1C Flags Affected: IF=1, PF=1
07110 80 SUB BL,30h Addressing Mode: immediate
07111 EB Flags Affected: IF=1
07112 30
07113 F6 MUL BL Flags Affected: IF=1
07114 E3
07115 D4 AAM Flags Affected: IF=1, PF=1
07116 0A
07117 46 INC SI Flags Affected: IF=1

07118 89 MOV [SI], AX Addressing Mode: indirect


07119 04 Flags Affected: IF=1

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 14


EC2232
Microprocessors & Microcontrollers Lab

ii) ORIGINAL SOURCE CODE Window Screen Shot:

iii) EMULATOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 15


EC2232
Microprocessors & Microcontrollers Lab

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

Name: Vasudev Dwivedi Reg. No.: 199202093 16


EC2232
Microprocessors & Microcontrollers Lab

RESULT: Thus, an ALP to multiply two single ASCII digits available in memory is written
and the result is stored in unpacked BCD form in memory.

COMMENTS & i) Registers Used: AX, BX, SI


DISCUSSION: ii) Total Memory Used: 21 bytes
iii) Total Clock Cycles Used: 207
iv) Alternative instructions: Instructions that would result in same functioning
of the program.
v) Subtract 30h from the data to get ascii digit.

Name: Vasudev Dwivedi Reg. No.: 199202093 17


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 6
(DIVISION)

AIM: WALP to perform division operation using two 8-bit hexadecimal numbers
available in memory and store the result in the memory. (a>b)

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start the program START
Step 2) Initialize two 8-bit data in
AL←[SI] ; INC SI
registers
Step 3) Divide the data in registers DIV [SI] ; INC SI
Step 4) Store the result in some other [SI]←AX
register
STOP
Step 5) End the program

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07100 EB jmp start Transferred the control to start
07101 04 IF=1
Direct program addressing
07012 36 vec1 36h, 24h, ? , ?
07103 24
07104 00
07105 00
07106 BE lea si, vec1 Addressing Mode: immediate
07107 02 Flags Affected: IF=1
07108 01
divide

Name: Vasudev Dwivedi Reg. No.: 199202093 18


EC2232
Microprocessors & Microcontrollers Lab

07109 8A mov al, [si] Addressing Mode: indirect register


0710A 04 Flags Affected: IF=1
0710B 46 inc si Flags Affected: IF=1, PF=1
0710C F6 div Flags Affected: IF=1, PF=1
0710D 34
0710E 46 ret

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 19


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 20


EC2232
Microprocessors & Microcontrollers Lab

v) STACK Window Screen Shot (if used):

RESULT: Thus, an ALP to perform division operation using two 8-bit hexadecimal
numbers was written and executed in emu8086.

COMMENTS & i) Registers Used: AX, SI


DISCUSSION: ii) Total Memory Used: 12 bytes
iii) Total Clock Cycles Used: 106
iv) Alternative instructions: Instructions that would result in same functioning
of the program.
v) It is not essential to specify AL as an operand in the execution of DIV
instruction.

Name: Vasudev Dwivedi Reg. No.: 199202093 21


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 7
(POSITIVE_NEGATIVE NUMBER SEARCH)

AIM: WALP to find the number of positive and negative data elements present in a
given array of ten signed hexadecimal numbers stored in memory. Store the
count of positive and negative numbers in memory. Using Repeat-Until
structure.
Use Sequence: 28h,9Eh,32h, 0ABh, 83h, 0A4h, 4fh, 68h, 12h, 72h.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start
START
Step 2) Declare an array of 12 locations.
Step 3) Run loop program statements CX←0Ah
Step 4) Decrement repeat count
Step 5) Stop AND AL, 0FFH

decrement repeat count

No loop
done?
Yes
STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07100 EB jmp start Transferred the control to start
07101 0C IF=1
Direct program addressing

Name: Vasudev Dwivedi Reg. No.: 199202093 22


EC2232
Microprocessors & Microcontrollers Lab

07102 28 vec1 28h,9Eh,32h


07103 9E ,0ABh,83h,0A4h
07104 32 ,4fh,68h,
07105 AB 12h,72h,?,?

07106 83
07107 A4
07108 4F
07109 68
0710A 12
0710B 72
0710C 00
0710D 00
0710E B9 MOV CX, 0Ah Addressing Mode: immediate
0710F 0A Flags Affected: IF=1
07110 00
07111 BE LEA SI, vec1 Addressing Mode: immediate
07112 02 Flags Affected: IF=1
07113 01
REPEAT
07114 8A MOV AL, [SI] Addressing Mode: indirect register
07115 04 Flags Affected: IF=1

07116 24 AND AL, 0FFH Addressing Mode: immediate


07117 FF Flags Affected: IF=1, PF=1

07118 79 JNS PVE Flags Affected: IF=1, PF=1


07119 04
NVE
0711A FE INC DL Flags Affected: IF=1
0711B C2
0711C EB JMP UNTIL Flags Affected: IF=1
0711D 02
PVE

Name: Vasudev Dwivedi Reg. No.: 199202093 23


EC2232
Microprocessors & Microcontrollers Lab

0711E FE INC BL Flags Affected: IF=1


0711F C3

UNTIL
07120 46 INC SI Flags Affected: IF=1, PF=1
07121 E2 LOOP REPEAT Flags Affected: IF=1, PF=1
07122 F1

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 24


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 25


EC2232
Microprocessors & Microcontrollers Lab

v) STACK Window Screen Shot (if used):

vi)

RESULT: Thus, an ALP to find the number of positive and negative data elements
present in a given array of ten signed hexadecimal numbers is written and
executed in emu8086.

COMMENTS & i) Registers Used: AX, BX. CX, DX


DISCUSSION: ii) Total Memory Used: 17 bytes
iii) Total Clock Cycles Used: 46
iv) Alternative instructions: Instructions that would result in same functioning
of the program.
v) 0FFH is ANDed with AL content to check for sign

Name: Vasudev Dwivedi Reg. No.: 199202093 26


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 8
(EXCHANGE OPERATION)

AIM: WALP to exchange corresponding elements of two data blocks of length 10-
bytes stored in memory starting from 0102H and 010CH respectively.
Using WHILE structure. Use sequence:
Sequence1: 01Ah, 0B2h, 05h, 06h, 55h, 0CAh, 07h, 0FFh, 4Dh, 0E2H
Sequence2 :28h, 9Eh, 32h, 0ABh, 83h, 0A4h, 4Fh, 68h, 12h, 72h

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start
START
Step 2) initialise two vectors
Step 3) initialise counter to 0Ah cl←0Ah
Step 4) interchange elements
al←[si]
Step 5) stop
xchg al, [di]
xchg al,[si]

increment pointers;
decrement counter

cl=0

STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07102 1A vec1 01Ah, Addressing Mode: immediate
07103 B2 0B2h, 05h,
07104 05 06h, 55h,

07105 06 0CAh,

Name: Vasudev Dwivedi Reg. No.: 199202093 27


EC2232
Microprocessors & Microcontrollers Lab

07106 55 07h, 0FFh,


07107 CA 4Dh, 0E2H
07108 07
07109 FF
0710A 4D
0710B E2

0710C 28 vec2 28h, 9Eh, Addressing Mode: immediate


0710D 9E 32h, 0ABh,
0710E 32 83h, 0A4h,

0710F AB 4Fh, 68h,

07110 83 12h, 72h

07111 A4
07112 4F
07113 68
07114 12
07115 72

07116 BE lea si, vec1 Addressing Mode: immediate


07117 02 Flags Affected: IF=1
07118 01

07119 BF lea di, vec2 Addressing Mode: immediate


0711A 0C Flags Affected: IF=1
0711B 01

0711C B1 mov Cl, 0Ah Addressing Mode: immediate


0711D 0A Flags Affected: IF=1
AGAIN
0711E 74 jz NEXT Flags Affected: IF=1

Name: Vasudev Dwivedi Reg. No.: 199202093 28


EC2232
Microprocessors & Microcontrollers Lab

0711F 0C
07120 8A mov al, [si] Addressing Mode: register indirect
07121 04 Flags Affected: IF=1

07122 86 xchg al, [di] Addressing Mode: register indirect


07123 05 Flags Affected: IF=1
07124 86 xchg al,[si] Addressing Mode: register indirect
07125 04 Flags Affected: IF=1
07126 46 inc si Flags Affected: IF=1, PF=1
07127 47 inc di Flags Affected: IF=1
07128 5E dec cl Flags Affected: IF=1, PF=1
07129 C9
0712A EB jmp AGAIN
0712B F2

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 29


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 30


EC2232
Microprocessors & Microcontrollers Lab

v) STACK Window Screen Shot (if used):

RESULT: Thus, ALP to exchange corresponding elements of two data blocks of


length 10-bytes stored in memory starting from 0102H and 010CH
respectively was written and executed in emu8086.

COMMENTS & i) Registers Used: AX, SI, DI, CX


DISCUSSION: ii) Total Memory Used: 14 bytes
iii) Total Clock Cycles Used: 35
iv) Alternative instructions: Instructions that would result in same
functioning of the program.
v) Program runs until the counter turns 0.

Name: Vasudev Dwivedi Reg. No.: 199202093 31


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 9
(SEARCHING OPERATION)

AIM: WALP to search whether the number, 77h, is present in the given data
block or not. If it is present then, store “1111h”, otherwise “ffffh” in DX.
Using WHILE structure. Use sequence:
Sequence-1: 0ABh, 23h, 0A5h, 0C3h, 0BEh, 0ACh, 097h.
Sequence-2: 0CDh, 57h, 79h, 22h, 0B1h, 77h, 057h.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start
START
Step 2) Load the counter with 07h
Step 3) Load the number to be searched for in cl←07h
al
Step 4) compare al with si pointed contents
cmp al,[si]
Step 5) stop

increment pointers;
decrement counter

cl=0

STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07102 CD vec2 0CDh,
07103 57 57h, 79h,
07104 79 22h, 0B1h,

07105 22 77h, 057h

Name: Vasudev Dwivedi Reg. No.: 199202093 32


EC2232
Microprocessors & Microcontrollers Lab

07106 B1
07107 77
07108 57

07109 BE lea si, vec2 Flags Affected: IF=1


0710A 02
0710B 01

0710C 5C cld Flags Affected: IF=1


0710D B1 mov cl, 07h Addressing Mode: immediate
0710E 07 Flags Affected: IF=1
0710F B0 mov al, 77h Addressing Mode: immediate

07110 77 Flags Affected: IF=1

AGAIN
07111 74 jz NEXT2 Flags Affected: IF=1
07112 0E
07113 3A cmp al, [si] Addressing Mode: register indirect
07114 04 Flags Affected: CF=1, SF=1, OF=1,
PF=1, AF=1, IF=1
07115 74 jz NEXT1 Flags Affected: CF=1, SF=1, OF=1,
07116 05 PF=1, AF=1, IF=1
07117 46 inc si Flags Affected: CF=1, PF=1, IF=1
07118 FE dec cl Flags Affected: CF=1, PF=1, IF=1
07119 C9
0711A EB jmp AGAIN Flags Affected: CF=1, PF=1, IF=1
0711B F5
NEXT1
0711C DA mov dx, 1111h Addressing Mode: immediate
0711D 11 Flags Affected: ZF=1, PF=1, IF=1
0711E 11
0711F EB jmp STOP Flags Affected: ZF=1, PF=1, IF=1
07120 03
NEXT2

Name: Vasudev Dwivedi Reg. No.: 199202093 33


EC2232
Microprocessors & Microcontrollers Lab

07121 BA mov dx, Addressing Mode: immediate


07122 FF 0FFFFH
07123 FF
STOP

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 34


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

Name: Vasudev Dwivedi Reg. No.: 199202093 35


EC2232
Microprocessors & Microcontrollers Lab

RESULT: Thus, ALP to search whether the number, 77h, is present in the given data
block or not. If it is present then, store “1111h”, otherwise “ffffh” in DX was
written and executed in emu8086.

COMMENTS & i) Registers Used: AX, CX, DX, SI


DISCUSSION: ii) Total Memory Used: 21 bytes
iii) Total Clock Cycles Used:27
iv) Alternative instructions: Instructions that would result in same
functioning of the program.
v) Zero flag is set to 1 when the two compared quantities are equal

Name: Vasudev Dwivedi Reg. No.: 199202093 36


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 10
(SERACH OPERATION STRINGS)

AIM: WALP to find number of times letter ‘e’ appears in the given string,
‘exercise’. Store the count in memory. Using WHILE structure.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start
START
Step 2) initialise the count
Step 3) run the loop program to count e
Intialise count
Step 4) decrement repeat count
Step 5) Stop
loop program statements

decrement repeat count

loop
done?
(CC=true) YES

STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07100 EB jmp start Transferred the control to start
07101 09 IF=1
Direct program addressing
07102 65 vec1
07103 78
07104 65
07105 72

Name: Vasudev Dwivedi Reg. No.: 199202093 37


EC2232
Microprocessors & Microcontrollers Lab

07106 63
07107 69
07108 73
07109 65
0710A 00
0710B BE lea si, vec1 Addressing Mode: immediate
0710C 02 Flags Affected: IF=1
0710D 01
0710E FC cld Flags Affected: IF=1
0710F B1 mov Cl, 08h Addressing Mode: immediate
07110 08 Flags Affected: IF=1
07111 B0 mov al, ‘e’ Addressing Mode: immediate
07112 65 Flags Affected: IF=1
07113 74 jz NEXT2 Flags Affected: IF=1
07114 0D
07115 3A cmp al, [si] Flags Affected: IF=1, ZF=1, PF=1
07116 04
07117 74 jz NEXT1 Flags Affected: IF=1, ZF=1, PF=1
07118 05
07119 46 inc si Flags Affected: IF=1, PF=1
0711A FE dec cl Flags Affected: IF=1
0711B C9
0711C EB jmp again Flags Affected: IF=1, CF=1, PF=1
0711D F5

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 38


EC2232
Microprocessors & Microcontrollers Lab

ii) ORIGINAL SOURCE CODE Window Screen Shot:

iii)EMULATOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 39


EC2232
Microprocessors & Microcontrollers Lab

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

Name: Vasudev Dwivedi Reg. No.: 199202093 40


EC2232
Microprocessors & Microcontrollers Lab

RESULT: Thus, an ALP to find number of times letter ‘e’ appears in the given string,
‘exercise’ was written and executed in emu8086.

COMMENTS & i) Registers Used: AX, BX, CX, SI


DISCUSSION: ii) Total Memory Used:
iii) Total Clock Cycles Used:
iv) Alternative instructions: Instructions that would result in same
functioning of the program.
v) Any relevant points you would like to add. ADD MINIMUM ONE

Name: Vasudev Dwivedi Reg. No.: 199202093 41


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 11
(SMALLEST NUMBER SEARCH)

AIM: WALP to find smallest number from the ten elements of a given array of 2-
digit hex numbers. Using SUBROUTINE. Use sequence:
Sequence-1: 0ABh, 23h, 0A5h, 0C3h, 0BEh, 0ACh, 097h, 79h, 22h, 0B1h.
Sequence-2: 0CDh, 10h, 79h, 0B1h, 77h, 057h, 0ABh, 23h, 22h, 01h.

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start
START
Step 2) Initialise count
Step 3) run loop program statements
Intialise count
Step 4) smallest number obtained
Step 5) stop
loop program statements

decrement repeat count

loop
done?

STOP

PROGRAM:
Physical Data / Labels Mnemonics Operand(s) Comments:
Address OpCode i) Addressing Mode:
ii) Flags Affected:
07100 EB jmp Transferred the control to start
07101 15 IF=1
Direct program addressing

Name: Vasudev Dwivedi Reg. No.: 199202093 42


EC2232
Microprocessors & Microcontrollers Lab

07102 AB vec1 0ABh, 23h,


07103 23 0A5h,
07104 A5 0C3h,
07105 C3 0BEh,

07106 BE 0ACh,

07107 AC 097h, 79h,

07108 97 22h, 0B1h,


?
07109 79
0710A 22
0710B B1
0710C 00
repeat
0710D 46 inc si Flags Affected: PF=1, IF=1
0710E 3A cmp al, [si] Addressing Mode: register indirect
0710F 04 Flags Affected: PF=1, IF=1, SF=1
07110 72 jc until Flags Affected: PF=1, IF=1, SF=1
07111 02
07112 8A mov al, [si] Addressing Mode: register indirect
07113 04 Flags Affected: PF=1, IF=1, SF=1
07114 90 loop repeat
07115 90

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 43


EC2232
Microprocessors & Microcontrollers Lab

ii) ORIGINAL SOURCE CODE Window Screen Shot:

iii)EMULATOR Window Screen Shot:


Name: Vasudev Dwivedi Reg. No.: 199202093 44
EC2232
Microprocessors & Microcontrollers Lab

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

Name: Vasudev Dwivedi Reg. No.: 199202093 45


EC2232
Microprocessors & Microcontrollers Lab

RESULT: Thus, an ALP to find smallest number from the ten elements of a given
array of 2-digit hex numbers was written and executed in emu8086.

COMMENTS & i) Registers Used: AX, CX, SI


DISCUSSION: ii) Total Memory Used: 26 bytes
iii) Total Clock Cycles Used: 70
iv) Alternative instructions: Instructions that would result in same
functioning of the program.
v) Count is taken one number lesser than the given contents as si points to
the next location.

Name: Vasudev Dwivedi Reg. No.: 199202093 46


EC2232
Microprocessors & Microcontrollers Lab

EXPERIMENT No. 12
(SORTING OPERATION)

AIM: Write a program to arrange the elements of a given array of 8-bit hexadecimal
numbers stored in the memory in ascending order.
Use sequence: 0ABh, 23h, 0A5h, 0C3h, 0BEh, 0ACh, 097h, 79h, 22h, 0B1h

HARDWARE / emu 8086 – assembler and microprocessor emulator 4.08


SOFTWARE USED:

ALGORITHM: FLOW CHART:


Step 1) Start START
Step 2) Declare an array of memory
location CL←0Ah, DEC CL
Step 3) Start the counter and decrement it
by 1 BL←CL; LEA SI, vec1
Step 4) Use bubble sort technique
compare/
Step 5) Stop exchange elements

STOP

PROGRAM:
Physica Data / Label Mnemonics Operand(s) Comments:
l OpCode s i) Addressing Mode:
Addres ii) Flags Affected:
s
07100 C3 JMP start Transferred the control to start
07101 0A IF=1
Direct program addressing

Name: Vasudev Dwivedi Reg. No.: 199202093 47


EC2232
Microprocessors & Microcontrollers Lab

07102 02 vec1 03h, 04h, 08h,


07103 03 09h,00h, 01h,
07104 04 02h, 05h, 07h,
07105 08 06h

07106 09
07107 00
07108 01
07109 02
0710A 05
0710B 07
0710C B1 MOV CL, 0Ah Addressing Mode: Immediate
0710D 0A Flags Affected: none
0710E FE DEC CL Flags Affected: IF=1
0710F C9
pass
07110 8A MOV BL, CL Addressing Mode: register
07111 D9 Flags Affected: PF=1, IF=1
07112 BE LEA SI, VEC1 Flags Affected: PF=1, IF=1
07113 02
07114 01
comp
07115 8A MOV AL, [SI] Addressing Mode: register indirect
07116 04 Flags Affected: PF=1, IF=1
07117 46 INC SI Flags Affected: PF=1, IF=1
07118 3A CMP AL, [SI] Addressing Mode: register indirect
07119 04 Flags Affected: CF=1, SF=1, PF=1,
AF=1, IF=1
0711A 72 JC L1 Flags Affected: CF=1, SF=1, PF=1,
0711B 06 AF=1, IF=1
0711C 86 XCHG AL, [SI] Addressing Mode: register indirect
0711D 04 Flags Affected: PF=1, IF=1
0711E 4E DEC SI Flags Affected: PF=1, IF=1
0711F 88

Name: Vasudev Dwivedi Reg. No.: 199202093 48


EC2232
Microprocessors & Microcontrollers Lab

OBSERVATION: (EMU8086 screen shots)


i) EDITOR Window Screen Shot:

ii) ORIGINAL SOURCE CODE Window Screen Shot:

Name: Vasudev Dwivedi Reg. No.: 199202093 49


EC2232
Microprocessors & Microcontrollers Lab

iii)EMULATOR Window Screen Shot:

iv) FLAGS Window Screen Shot:

v) STACK Window Screen Shot (if used):

RESULT: Thus, a program to arrange the elements of a given array of 8-bit hexadecimal
numbers stored in the memory in ascending order is written and executed in
emu8086.

Name: Vasudev Dwivedi Reg. No.: 199202093 50


EC2232
Microprocessors & Microcontrollers Lab

COMMENTS & i) Registers Used: AX, BX, SI, CX


DISCUSSION: ii) Total Memory Used: 25 bytes
iii) Total Clock Cycles Used: 65
iv) Alternative instructions: use selection sort technique
v) Exchange of location will only take place if the two numbers are not in
ascending order.

Name: Vasudev Dwivedi Reg. No.: 199202093 51

You might also like