Lab Assignment - 3
Interfacing using 8086-Microprocessor Kit
Microprocessor-Based System Design
(UCS617) By
Name of student Roll number
Submitted to
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
THAPAR INSTITUTE OF ENGINEERING AND TECHNOLOGY
(DEEMED TO BE UNIVERSITY)
PATIALA, PUNJAB (INDIA)
JAN – JUNE 2022
MICROPROCESSORS
S.No Name of Experiments Page
No.
1 Write an assembly language program to add two 16-bit numbers in 2
8086.
2 Write an assembly language program to subtract two 16-bit numbers in 4
8086.
3 Write an assembly language program to multiply two 16-bit numbers 6
in 8086.
4 Write an assembly language program to divide two 16-bit numbers 8
in 8086.
5 Write an assembly language program to demonstrate AAA, AAS, 10
AAM, AAD, DAA and DAS in 8086.
6 Write an assembly language program to find out the count of positive 15
numbers and negative numbers from a series of signed numbers in
8086.
7 Write an assembly language program to find out the largest number from 17
a given unordered array of 8-bit numbers, stored in the locations starting
from a known address in 8086.
8 Write an assembly language program to find out the largest number 19
from a given unordered array of 16-bit numbers, stored in the locations
starting from a known address in 8086.
9 Write an assembly language program to print Fibonacci series in 8086. 21
10 Write an assembly language program to perform the division 15/6 using 23
the ASCII codes. Store the ASCII codes of the result in register DX.
1
Experiment 1
Q. Write an assembly language program to add two 16-bit numbers in 8086.
Soln. -
MOV AX,1234H
MOV BX,1236H
ADD AX,BX
HLT
Output:
2
3
Experiment 2
Q. Write an assembly language program to subtract two 16-bit numbers in 8086.
Soln. -
MOV AX,1234H
MOV BX,1236H
SUB AX,BX
HLT
Output:
4
5
Experiment 3
Q. Write an assembly language program to multiply two 16-bit numbers in 8086.
Soln. -
MOV AX,[0301H]
MOV BX,[0303H]
MUL BX
HLT
Output:
6
7
Experiment 4
Q. Write an assembly language program to divide two 16-bit numbers in 8086.
Soln. -
MOV AX,[0301H]
MOV BX,[0303H]
DIV BX
HLT
Output:
8
9
Experiment 5
Q. Write an assembly language program to demonstrate AAA, AAS, AAM, AAD, DAA and
DAS in 8086
Soln.
AAA AAS
MOV AX,0032H MOV AL,0033H
MOV BX,0033H SUB AX,0039H
ADD AX,BX AAS
AAA OR AL,0030H
HLT HLT
AAM AAD
MOV AL,03H MOV AX,0033H
MOV BL,09H MOV BX,0032H
MUL BL AAD
AAM DIV BX
OR AX,3030H HLT
HLT
10
DAA DAS
MOV AL,71H MOV AL,71H
ADD AL,43H' SUB AL,43H'
DAA DAS
HLT HLT
11
AAA Instruction
AAS Instruction
12
AAM Instruction
AAD Instruction
13
DAA Instruction
DAS Instruction
14
Experiment 6
Q. Write an assembly language program to find out the count of positive numbers and negative
numbers from a series of signed numbers in 8086.
Soln. -
MOV CL,0AH
MOV BL,00H
MOV DL,00H
LEA SI, [1000H]
L1: MOV AL, [SI]
SHL AL, 01
JNC L2
INC DL
JMP L3
L2: INC BL
L3: INC SI
DEC CL
JNZ L1
MOV [100AH], BL
MOV [100BH], DL
HLT
15
16
Experiment 7
Q. Write an assembly language program to convert to find out the largest number from a given
unordered array of 8-bit numbers, stored in the locations starting from a known address in 8086.
Soln. -
MOV CL, 0AH
LEA SI, [1000H]
MOV AL, [SI]
L1: INC SI
MOV BL, [SI]
CMP AL, BL
JC L2
JMP L3
L2: MOV AL, BL
L3: DEC CL
JNZ L1
MOV [100AH], AL
HLT
Output:-
17
18
Experiment 8
Q. Write an assembly language program to find out the largest number from a given
unordered array of 16-bit numbers, stored in the locations starting from a known address in
8086.
Soln. -
MOV BX, 1000H
MOV C L, [BX]
INC BX
MOV AX, [BX[
DEC CL
Back: INC BX
INC BX
CMP AX, [BX]
JNC Next
MOV AX,
[BX] Next:
DEC CL JNZ
Back
MOV [1020H], AX
HLT
19
20
Experiment 9
Q. Write an assembly language program to print Fibonacci series in 8086.
Soln. -
MOV AL,00H
MOV SI,500H
MOV [SI],AL
ADD SI,01H
ADD AL,01H
MOV [SI],AL
MOV CX,[0000H]
SUB CX,0002H
L1:MOV AL,[SI-1]
ADD AL,[SI]
ADD SI,01H
MOV [SI],AL
LOOP L1
HLT
Output:
21
22
Experiment 10
Q. Write an assembly language program to perform the division 15/6 using the ASCII
codes. Store the ASCII codes of the result in register DX.
Soln. -
MOV AX,‟15‟
MOV BX, „6‟
SUB AX, 3030H
SUB BH, 30H
AAD
DIV BH
ADD AX, 3030H
MOV [SI ], AX
HLT
23
INDEX
S.NO. LIST OF PROGRAMS PAGE NO.
1. Interfacing ET-8255 study card with ET-8086 microprocessor hardware kit 3
(Excel Technologies)
2. Interfacing ET-8253 study card with ET-8086 microprocessor hardware kit 6
(Excel Technologies)
3. Interfacing ET-8279 study card with ET-8086 microprocessor hardware kit 9
(Excel Technologies)
4. Interfacing ET-8251 study card with ET-8086 microprocessor hardware kit 12
(Excel Technologies)
5. Interfacing ET-8259 study card with ET-8086 microprocessor hardware kit 14
(Excel Technologies)
Page 2
1. Interfacing ET-8255 study card with ET-8086 microprocessor hardware kit
(Excel Technologies)
Steps:
Step1. Connect the card to the kit through a 50-pin cable. Ensure that the pin-1 of the
card is connected to the pin-1 of the kit Bus connector. The Pin Nos. are marked in kit
and card.
Step2. Connect +5V and GND to the Kit and switch on the supply. If the Kit used is with
built in Power Supply, then +5V and Gnd are internally connected and one just needs to
switch on the power and Press Reset.
Step3. Select the SW2 switch in OFF position & Enter the program given below using
Sub MIR command if you want to enter in machine code or use Ex MEM command for
entering the program in Assembly language.
Step4. Execute the program using <GO> command The Program stops after the first V/O
Instruction. Observe the LED status as explained in the program below.
Step5. Press Swl one by one and observe the LED's status as explained in the program.
Command Table:
CS: IP Op-Code Label Mnemonics Comments Observations
1000:100 BO 80 START MOV AL, 80 Configure A/B/C
: port as output
102 BA 86 00 MOV DX, 86
105 EE OUT DX, AL Observe 80 on D0
To D7 LED’s
106 B0 AA LOOP: MOV AL, AAH
108 BA 80 00 MOV DX, 80
10B EE OUT DX, AL Out data AA on Observe AA on
Port A A00 to A07 LED’s
Page 3
10C BA 82 00 MOV DX, 82
10F EE OUT DX, AL Out data AA on Observe AA on
Port B B00 to B07 LED’s
110 B9 FF FF MOV DX, 84
113 EE OUT DX, AL Out data AA on Observe AA on
Port C C00 to C07 LED’s
114 B9 FF FF MOV CX, FFFF
117 CD AA INT AA CALL DELAY
119 B0 55 MOV AL, 55
11B BA 80 00 MOV DX, 80
11E EE OUT DX, AL Out data 55 on Observe 55 on A00
Port A to A07 LED’s
11F BA 82 00 MOV DX, 84
122 EE OUT DX, AL Out data AA on Observe 55 on B00
Port B to B07 LED’s
123 BA 84 00 MOV DX, 84 Out data 35 on Observe 55 on C00
Port C to C07 LED’s
126 EE OUT DX, AL
127 B9 FF FF MOV CX, FFFF
12A CD AA INT AA Call Delay
12C EB D8 JMP 0106 Loop Back
Page 4
Fig 1.1: Output of the above program.
Page 5
2. Interfacing ET-8253 study card with ET-8086 microprocessor hardware kit
(Excel Technologies)
Steps:
Step1. Connect the card to the kit through a 50-pin cable. Ensure that the pin-1 of the
card is connected to the pin-1 of the kit Bus connector. The Pin Nos. are marked in kit
and card.
Step2. Connect +5V and GND to the Kit and switch on the supply. If the Kit used is with
built in Power Supply, then +5V and Gnd are internally connected and one just needs to
switch on the power and Press Reset.
Step3. Select the SW2 switch in OFF position & Enter the program given below using
Sub MIR command if you want to enter in machine code or use Ex MEM command for
entering the program in Assembly language.
Step4. Execute the program using <GO> command The Program stops after the first V/O
Instruction. Observe the LED status as explained in the program below.
Step5. Press Swl one by one and observe the LED's status as explained in the
observation. Observe square wave form on pin no.- 13 of 8253 or OUT1 Pin on the
card.
Command Table:
Address Op-Code Label Mnemonics Comments Observation
1000:100 BA 96 00 START: MOV DX,96 Timer 1 is Observe 76 on the
selected in data bus LEDs
mode 3, 16-bit Observe A0, AI LED
binary counter. ON, CS-ON, WR-ON
0103 B0 76 MOV AL, 76
0105 EE OUT DX, AL
0106 B0 A0 XX: MOV AL, A0 LOAD A0 as
LSB first
0108 BA 92 00 MOV DX, 92
Page 6
10B EE OUT DX, AL WR, CS-ON, AO
& AI-OFF, WR*-
On
10C B0 00 MOV AL, 00 LOAD A0 as
MSB 00
11E EE OUT DX, AL AI LED ON, CS-
ON, WR-ON
11F ED EF JMP 0100 LOOP BACK
Page 7
Fig 2.1: Output of the above program
Page 8
3. Interfacing ET-8279 study card with ET-8086 microprocessor hardware kit
(Excel Technologies)
Steps:
Step1. Connect the card to the kit through a 50-pin cable. Ensure that the pin-1 of the
card is connected to the pin-1 of the kit Bus connector. The Pin Nos. are marked in kit
and card.
Step2. Connect +5V and GND to the Kit and switch on the supply. If the Kit used is with
built in Power Supply, then +5V and Gnd are internally connected and one just needs to
switch on the power and Press Reset.
Step3. Select the SW2 switch in OFF position & Enter the program given below using
Sub MIR command if you want to enter in machine code or use Ex MEM command for
entering the program in Assembly language.
Step4. Execute the program using <GO> command The Program stops after the first V/O
Instruction. Observe the LED status as explained in the program below.
Step5. Press Swl one by one and observe the LED's status as explained in the
observation. Observe square wave form on pin no.- 13 of 8253 or OUT1 Pin on the
card.
Command Table:
CS : IP Code Label Mnemonics Comments Observation
1000:400 B0 00 START MOV AL, 00 Command word
for 8 bit
character display
402 BA 72 01 MOV DX D0 to D7 are
0172 OFF. WR*, CS*
and A0 are ON.
405 EE OUT DX, AL Issue clear
command
406 B0 DF MOV AL, 87 DF on the data
bus.
408 EE OUT DX, AL
Page 9
409 B0 87 MOV AL, 87 Command to write 87 on the data
8th display RAM display
location
40B EE OUT DX, AL Set counter for
the lookup table
40C B3 10 MOV BL, 10 Call display
routine
40E BE 00 13 MOV SI,
1300
411 BA 70 01 MOV DX,
0170
414 8A 04 MOV AL, Move 1st data byte
[SI] to accumulator
416 EE OUT DX, AL The code of the
1st character 03 is
displayed
417 46 INC SI Increment the
memory pointer in
look up table
418 FE CB DEC BL Decrement the
counter
41A 75 F8 JNZ 414
41C EB E2 JMP 400 Loop back
Code At Address 0000: 1300 Onward
0000:1300 03 Code For 0
1301 9F Code For 1
Page 10
1302 25 Code For 2
1303 0D Code For 3
1304 99 Code For 4
1305 49 Code For 5
1306 41 Code For 6
Fig 3.1: Output of the above program.
Page 11
4. Interfacing ET-8251 study card with ET-8086 microprocessor hardware kit
(Excel Technologies)
Steps:
Step1. Connect the card to the kit through a 50-pin cable. Ensure that the pin-1 of the
card is connected to the pin-1 of the kit Bus connector. The Pin Nos. are marked in kit
and card.
Step2. Connect +5V and GND to the Kit and switch on the supply. If the Kit used is with
built in Power Supply, then +5V and Gnd are internally connected and one just needs to
switch on the power and Press Reset.
Step3. Select the SW2 switch in OFF position & Enter the program given below using
Sub MIR command if you want to enter in machine code or use Ex MEM command for
entering the program in Assembly language.
Step4. Execute the program using <GO> command The Program stops after the first V/O
Instruction. Observe the LED status as explained in the program below.
Step5. Press Swl one by one and observe the LED's status as explained in the
observation. Observe square wave form on pin no.- 13 of 8253 or OUT1 Pin on the card.
Command Table:
Address Opcodes Comments Mnemonics Observation
1000:0100 BA 82 00 MOV DX, 82 Initialize 8251
0103 B0 CE MOV AL, CE
0105 EE OUT DX, AL Observe CE
on data LED’s
WR*-ON,
A0-ON, AI-OFF,
CS*-ON
0106 B0 37 MOV AL, 37
0108 EE OUT DX, AL Observe 37
on data
LED’s
0109 EC IN AL, DX Check for Tx flag
Page 12
010A 24 01 AND AL, 01
010C 74 FB JZ 109 If not check
again
010E B0 41 MOV AL, 41 Load the ASCII
Code of “A”
0110 BA 80 00 MOV DX, 80
0113 EE OUT DX, AL Observe 41 on the
LED’s and “A”
on the screen of
PC/AT
0114 EB F8 JMP 10E Loop Back to out
the next
character
Fig 4.1: Output of the above program.
Page 13
5. Interfacing ET-8259 study card with ET-8086 microprocessor hardware kit (Excel
Technologies)
Steps:
Step1. Connect the card to the kit through a 50-pin cable. Ensure that the pin-1 of the
card is connected to the pin-1 of the kit Bus connector. The Pin Nos. are marked in kit
and card.
Step2. Connect +5V and GND to the Kit and switch on the supply. If the Kit used is with
built in Power Supply, then +5V and Gnd are internally connected and one just needs to
switch on the power and Press Reset.
Step3. Select the SW2 switch in OFF position & Enter the program given below using
Sub MIR command if you want to enter in machine code or use Ex MEM command for
entering the program in Assembly language.
Step4. Execute the program using <GO> command The Program stops after the first V/O
Instruction. Observe the LED status as explained in the program below.
Step5. Press Swl one by one and observe the LED's status as explained in the
observation. Observe square wave form on pin no.- 13 of 8253 or OUT1 Pin on the card.
Command Table:
Address Opcodes Label Mnemonics Comments
1000:100 B8 0F 11 START: MOV AX, 110F Move 110 F in AX register
103 89 C4 MOV SP, AX Move content of AX in SP
105 0E PUSH CS Store content of CS in stack
106 58 POP AX Move content of stack in
AX register
107 89 C1 MOV CX, AX Move content of AX in CX
109 BE 55 01 MOV S1, 0155 Store address of
SER_ROUTINE in S1
register
Page 14
10C B0 91 MOV AL, 91 Give interrupt type to use
, for IR0-IR7=90-97
10E CD BE INT BE
110 BA 80 00 MOV DX, 80 Move address of CWR in
DX register
113 B0 19 MOV AL, 19 Initialization of 8259
115 EE OUT DX, AL Out content of AL at
address 80h
116 B0 90 MOV AL, 90 Initialize the ICW2 of 8259
118 BA 82 00 MOV DX, 82 Move address of ICW2 in
DX
11B EE OUT DX, AL Out AL at address 82h
11C B0 01 MOV AL, 01 Move 01 in AL register
11E EE OUT DX, AL Out contents of AL register
11F B0 FD MOV AL, FD Enable IRI and Disable
others
121 EE OUT DX, AL Out contents of AL register
122 FB ST1 Set interrupt flag
123 EB FE HERE: JMP 123 Wait for interrupt
Program From Address 1000:0155
Address Opcode Label Mnemonic Observation
1000:0155 CD AC SER_ROUT INT AC Clear display
Page 15
INE:
157 BA 41 00 AG86: MOV DX, 41 Data(A) for display
15A B4 02 MOV AH, 02
15C CD A2 INT A2 Interrupt for display char,
in DX register
15E CD AB INT AB Display at same cursor
160 EB F5 JMP 0157 Loop Back
Page 16
Fig 5.1: Output of the above program
Page 17