You are on page 1of 53

K.Sridhar Raju www.engglabs.blogspot.

com




By
K.Sridhar Raju
www.engglabs.blogspot.com











2


INDEX
Description Page No
1. List of experiments 3
2. 8086 kit details and operating procedure 4
3. Program and data sheet 6
4. Addition, Subtraction, Multiplication, Division Programs 8-12
5. Addressing Modes 13
6. Factorial 14
7. Positive and negative numbers from given series numbers. 15
8. Program to generate Fibonacci Series 16
9. program for block exchange 17
10. Find square of a number using XLAT instruction 18
11. Find the Greatest Common Divisor (GCD) of two numbers. 19
12. Copy a string of 6 bytes from memory to memory 20
13. Compare two strings 21
14. Packed BCD to unpacked BCD 22
15. Number of logic ones in a byte 23
16. Addition of a series of bytes from a given array 24
17. Find the largest number 25
18. Code conversions I. Binary to BCD, II. Hexadecimal to ASCII 26
19. Linear search 27
20. Two multi-byte numbers addition 28
21. Sorting 29
22. Square wave generation and Rate generator using 8253 30
23. Read voltage & display in digital using ADC with 8255 32
24. Square, triangular, sin wave generation using DAC with 8255 33
25. Interfacing 7-seg LED (CC,CA, BCD to 7-seg) with 8255 36
26. Interface stepper motor with 8255 37
27. Interface key board with 8255 39
28. Single LED interfacing with 8255 (bit set mode) 42
29. Digital Input and output card with 8255 43
30. Program Interface eight LEDs with 8051 44
31. Interface stepper motor with 8051 45
32. Interfacing 7-seg LED with 8051 46
33. MASM based programs 49






3



MICROPROCESSORS AND MICROCONTROLLERS LAB

CODE: EC 333 B.E 3/4 ECE- I Semester


PART A

[Experiments on assembly programming for 8086 using Assembler]

1. Study and use of 8086 microprocessor trainer kit and execution of programs
2. Programs using different addressing modes.
3. Multiplication and division.
4. Single byte, multi byte binary and BCD addition and Subtraction.
5. Code conversions.
6. String Searching and Sorting.
7. Generation of waveforms and gating applications using 8253/8254 timers.
8. Generation of waveforms using DAC interface.
9. Monitor utilities of 8086 kit for keyboard/displaying results.



PART B

[Experiments on assembly programming for 8051 using Assembler]


10. Familiarity and use of 8051/8031 Microcontroller trainer kit and execution of
programs.
11. Programs using different addressing modes.
12. Timer and counter programming.
13. Interfacing for D/A applications.
14. Interfacing for A/D applications
15. Interfacing traffic signal control.
16. Program to control stepper motor.
17. 7-segment display/LCD display interfacing.
18. Keyboard interfacing.











4


STUDY OF 8086 KIT


1. Study 8086 microprocessor and identify various components in 8086 trainer kit.
2. Crystal Oscillator generates 20MHz clock.
Clk 2(divide by 2) pin 14 , (8086 clk is 10MHz)
Clk 4(divide by 4 )pin 15, (8254 clk is 5MHz)
Clk 8(divide by 8)pin 13,(8255 clk is 2.5 MHz)

Operating Commands for SDA 8086 kit:

Step 1: Switch on the kit/ Reset the trainer.
ALS SDA 86-STA
Step 2: Key in A to go to Assembler mode
ALS 86 ASSEMBLER
Step 3: User has to key in Enter key. Line Assembler Prompt is now displayed.
>
The Assembler is waiting for an assembler commands which can be one of the
following:
Step 4: SG 0 to set the segment to 0
Step 5: Label Clear LC to clear the previous label for new session.
Step 6: DA 4000: Disassemble and Assemble. The user can key in assembler mnemonics.
The assembler expects inputs from the user to assemble from 0000:4000.
4000 B83412 MOV AX,#1234
Step 7: Assembler has now disassembled the instruction at 0000:4000 and has displayed
on LCD and is waiting for N key. N
Display by Assembler @
User has three choices:
1. User can key in a fresh instruction followed by Enter key.
2. User can key in Enter key if he does not want to alter the display code.
3. User can key in ! to come out of Assembler mode and then key in EX and
Enter key.
Step 8: MOV AL, [4100] <cr>
User has entered the above instruction.
5

MOV A00041 MOV AL,4100
User Response N
DA prompt @
Next instruction is disassembled and displayed 4003 BB3412 MOV BX,1234
User response N
DA prompt @
User can change the instruction and press Enter or to without change the instruction
Next instruction is disassembled and displayed 4006 01D8 ADD AX,BX
User response N
DA prompt @
User response INT 3 <cr>
New instruction is disassembled and displayed 4008 CC INT 3
User response to exit from DA mode option 3 !
Assembler prompt >
User response EX
Return to monitor *
GO COMMAND
The execute user program command allows the user to execute a program that user has
entered. The message GO appears in the first line of the display, when the user presses
the G key. The current user CS:IP and the instruction are displayed and the user can
change the address, if required, by either entering a Segment: Offset or just an offset.
The command is executed when the user presses enter key. The user can stop execution of
the program at a specified address by including an INT 3.
EXAM/MODIFY THE REGISTER CONTENTS
Press twice R EXAM REGISTER
BX
Press P for previous register and , for next register.
EXAM / MODIFY THE MEMORY CONTENTS
Press E twice EXAMBYTE
Modify the address as required and press , for check data 5678 C1
Press W EXAMWORD
Give the address as required and press , for check data 5678 41C1
6

PROGRAM SHEET:


Address

Instruction code Label Mnemonic Comment
































































7



DATA SHEET:


MEMORY LOCATION / REGISTER

DATA (HEX)






























































8

1. AIM: TO PERFORM ADDITION OF TWO BYTES
Apparatus: 8086 kit, power supply
Procedure/ Algorithm:
1. Load the first number in register AX.
2. Load the second number in register BX.
3. Perform addition operation on the register contents.
Program:
MOV AX, 1234 h
MOV BX, 2753h
ADD AX, BX
MOV CL, 00
ADC CL, 00
INT 3
Result:
SUM AX: 3987 H
CARRY CL: 0
Check with different data: ABCD and 9DEF

















9

2. AIM: TO PERFORM SUBTRACTION OF TWO BYTES
Apparatus: 8086 kit, power supply

Procedure/ Algorithm:
1. Load the minuend in a register AX.
2. Load the subtrahend in the second register BX.
3. Perform subtraction operation on the register contents.


Program:
MOV AX, 5678H
MOV BX, 1234H
SUB AX, BX
INT 3

Result:
AX: 4444H
Check with different data as:

Sign Flag Zero Flag
AX > BX 0 0
AX = BX 0 1
AX < BX 1 0











10

3. AIM: TO PERFORM MULTIPLICATION OF TWO BYTES

Apparatus: 8086 kit, power supply

Procedure/ Algorithm:
1. Load the multiplicand in a register AX.
2. Load the multiplier in the second register BX.
3. Perform multiplication operation on the register contents.

Data:


Program:
MOV AX, 2080
MOV BX, 0070
MUL BX
INT 3

Result:
AX: 38C0 H lower sixteen bit
DX: 02 H higher byte
i.e. 0238C0 H
Check with different data as:











11

4. AIM: TO PERFORM DIVISION OF TWO BYTES

Apparatus: 8086 kit, power supply

Procedure/ Algorithm:
1. Load the dividend in a register.
2. Load the divisor in the second register.
3. Perform division operation on the register contents.

Program:
MOV AX, 2056
MOV BX, 0004
DIV BX
INT 3

Result:
Quotient in AX: 0815 h
Reminder in DX: 02h
Check with different data:
Dividend is 16 bit and divisor is 8 bit
Divide error/ over flow

MOV AX, 2056
MOV BL, 04/45
DIV BL
INT 3
Quotient in AL: 77 h
Reminder in AH: 43h






12

5. AIM: WRITE AN ALP FOR 8086 USING ALL ADDRESSING MODES.


Apparatus: 8086 kit, power supply

Procedure/ Algorithm:
1. Initialize the contents of segment registers or general purpose registers using
immediate addressing mode.
2. The contents of memory locations can also be initialized using direct and indirect
addressing modes.

Program:
MOV AX, 0000H
MOV DS, AX
MOV AX, 1234
MOV SI, 5000
MOV [SI], AX
MOV [5000], AX
MOV 2[SI], AX
MOV BX, 1000
MOV [BX][SI], AX
MOV 2[BX][SI], AX
INT 3
Result:
DS: 0000 AX: 1234H, BX: 1000 5000: 34 6000: 34
SI: 5000 5001: 12 6001: 34
5002: 34 6002: 34
5003: 12 6003: 12






13


6. Aim: Write an ALP for finding the FACTORIAL of a given number.

Apparatus: 8086 kit, power supply
Procedure/ Algorithm:
1. Initialize the data segment.
2. Set product to one.
3. Inialise the pointer and fetch the data from the memory location using a pointer.
4. Multiply the data with product.
5. Repeat this until data becomes zero.
6. Increment pointer to store the final product obtained as the factorial of the given
number.
Program
MOV AX, 0000H
MOV DS, AX
MOV AX,1
MOV SI, 4100h hint: 4101 data should be zero.
MOV CX, [SI]
next: MUL CX
LOOP next
INC SI
MOV [SI], AX
INT 3

Input Address Data:
4100 : 04 (Input should be 8)

Result: 4101 : 18h
4102 : 00





14

7. AIM: WRITE A PROGRAM TO FIND OUT THE NUMBER OF
POSITIVE NUMBERS AND NEGATIVE NUMBERS FROM A GIVEN
SERIES OF SIGNED NUMBERS.

Apparatus: 8086 kit, power supply

Procedure/ Algorithm:

1. Initialize two registers for storing the number of positive and negative numbers.
2. Set the value of the counter.
3. Set data segment and pointer.
4. Get byte from memory to register.
5. Rotate register content left through carry by one bit position.
6. Check the carry flag.
7. If carry =1 then increment negative counter and go to step number 7.
8. If there is no carry, increment the positive counter and go to step number 7.
9. Increment pointer.
10. Decrement counter.
11. If counter is not equal to zero go to step 4.
12. Store the result.
13. Stop the program.



Program: Input
MOV BX, 0000H Data:
MOV AX, 0000H 6000: F8
MOV DS, AX; To initialize data segment 6001: 02
MOV SI, 6000H;Set pointer 6002: 82
MOV CX, 0006H;Set Count 6003: 48
L3: MOV AL, [SI]; 6004: 22
RCL AL, 1;Rotate left through carry 6005: C8
JNC L1;Check the carry
INC BH; Increment negative count F8=1111 1000
JMP L2; 02=0000 0010
L1: INC BL; Increment positive count 82= 1000 0010
L2:INC SI; Increment pointer 48= 0100 1000
LOOP L3; Decrement count 22= 0010 0010
MOV [SI], BL; C8= 1101 1000
INC SI;
MOV [SI], BH;
15

INT 03
Result: Negative No BH:03 Positive No BL :03




Questions: Modify the above program for counting odd and even numbers in a given
series of numbers and compare instruction in 8086.




























16

8. AIM: WRITE A PROGRAM TO GENERATE FIBONACCI SERIES.

Apparatus: 8086 kit, power supply
Algorithm/ Procedure:
1. Initialize a=0
2. Initialize b=1
3. while i<m do write (a, b), a=a+b, b=a+b, i=i+1
4. Stop the program
Program:
MOV AX, 0000H;
Result:
MOV DS, AX ; To initialize Data Segment
4200: 00
MOV CL, 0AH ; Set counter
4201: 01
XOR AL, AL ; Clear Accumulator
4202:01
MOV SI,4200H
4203: 02
MOV [SI], AL ; Move first number to AL
4204: 03
ADD AL, 01H;
4205: 05
INC SI ; Increment pointer
4206: 08
MOV [SI], AL
4207: 0D
MOV 1[SI],AL
4208: 15
INC SI;
4209: 22
SUB CL,03 ; three numbers are generated

back: ADD AL, [SI];

INC SI;

MOV [SI], AL;

DEC SI;

MOV AL, [SI];

INC SI;

LOOP back ; repeat same up to count is zero

INT 03

Questions:
1. Given two positive integers m and n, write an ALP to find the greatest common
divisor of them.
2. Write an ALP to find the factorial of a given number.
17


9. AIM: WRITE A PROGRAM FOR BLOCK EXCHANGE
Apparatus: 8086 kit, power supply
Algorithms/ Procedure;
1. Set source and destination pointers.
2. Set counter.
3. Get content of source pointer into one of the register (AL).
4. Get the content of destination pointer into another register (BL).
5. Place BL content into the source block and place AL content into the source
block.
6. Increment both the pointers.
7. Decrement counter.
8. If count not equal to zero go to step 3.
9. Stop the program.
Program:
MOV AX, 0000H; Data: Result:
MOV DS, AX; To initialize data
segment
5000:11 6000:AA 5000:AA 6000:11
MOV ES, AX; To initialize extra
segment
5001:22 6001: BB 5001: BB 6001:22
MOV SI, 5000H; Set source pointer 5002:33 6002: CC 5002: CC 6002:33
MOV DI, 6000H; Set destination pointer 5003:44 6003: DD 5003: DD 6003:44
MOV CX, 000AH; Set counter 5004:55 6004: EE 5004: EE 6004:55
L1: MOV AL, [SI]; 5005:66 6005: FF 5005: FF 6005:66
MOV BL, [DI];
MOV [DI], AL;
MOV [SI], BL;
INC SI;
INC DI; Increment pointers
LOOP L1;
INT 3; Break point
Questions:
1. Write an ALP to copy data from one memory area to another.
2. Modify the above program to exchange reverse order.
3. Explain LOOP, LOOPE, LOOPNE instructions.

18


10. AIM: TO WRITE AN ALP TO FIND SQUARE OF A NUMBER USING
LOOK-UP (XLAT) TABLE.

Apparatus: 8086 kit, power supply

Algorithm/ Procedure:
1. Store the values of squares from 0 to 9 in continuous memory locations.
2. Read the number for which square is required.
3. Form the address in BX register.
4. Store the result in another register.




Questions:
1. Can we find factorials using Look-up Tables?
2. Can we find sum of numbers using Look-up Tables?
3. What will you store in memory for questions 1 & 2?
4. Where are the changes required? Program or data or both?
5. Write the programs for above logic.
Program: Data:
MOV AX, 0000 H 6000: 00
MOV DS, AX ; To initialize Data segment register
MOV BX, 6000H ; To set Offset address 6001: 01
MOV AL, 04 ; Load code into AL 6002: 04
XLAT ; Translate one code to another code 6003: 09
MOV CL, AL ; Store result in CL 6004: 16
INT 3 ; Breakpoint 6005: 25
6006: 36
Result: AL = 16 6007:49
6008:64
XLAT AL = [BX+AL]
6009:81
19


11. AIM: WRITE A PROGRAM FOR GIVEN TWO POSITIVE INTEGERS N
AND M, TO FIND THE GREATEST COMMON DIVISOR (GCD) OF TWO
NUMBERS.

Apparatus: 8086 kit, power supply
PROGRAM: DATA
MOV SI,4050H Input Result
MOV DI,4060H 4050: 08 4060: 02
MOV AL,[SI] 4051: 02
MOV BL,1[SI]
CMP AL,BL
JNC GO
XCHG AL,BL
GO:MOV AH,00
DIV BL
CMP AH,00
JZ AGAIN
MOV AL,BL
MOV BL,AH
JMP GO
AGAIN:MOV [DI],BL
INT 3


Questions:
1. Write an ALP to reverse the given digits.
2. Explain IMUL and IDIV Instructions with help of examples.





20

12. AIM: WRITE AN ALP TO COPY A STRING OF 6 BYTES FROM MEMORY
STARTING FROM 2000:0004H INTO MEMORY STARTING FROM
3000:0014H.

Apparatus: 8086 kit, power supply.

Algorithm/Procedure:
1. Clear Direction Flag.(DF=0 i.e auto increment mode)
2. Set data segment and source index pointer.
3. Set extra segment and destination index.
4. Set counter.
5. Copy the string bytes from source to destination until count =0.


Program:
CLD ; clear Direction Flag for auto increment Data:
MOV AX, 2000H Input Result:
MOV DS, AX ; Initialize DS 2000:0004: 11 3000:0014:AA
MOV AX, 3000H 2000:0005: 22 3000:0015:BB
MOV ES, AX ; Initialize ES 2000:0006: 33 3000:0016:CC
MOV SI, 0004H ; Offset of source location in DS 2000:0007: 44 3000:0017:DD
MOV DI, 0014H; Offset of destination location in ES 2000:0008: 55 3000:0018:EE
MOV CX, 0006H ; length of the string 2000:0009: 66 3000:0019:FF
REP ; repeat the same up to CX is zero
MOVSB ;copy a byte from source to destination ,if DF=0,increment SI & DI
INT 3







21


13. AIM: WRITE AN ALP TO COMPARE TWO STRINGS.
Apparatus: 8086 kit, power supply.
Algorithm / Procedure:
1. Clear Direction Flag.( DF = 0 i.e auto increment mode)
2. Set Data Segment, extra segment, source and destination index.
3. Set counter.
4. Compare the source string bytes with destination string bytes until count =0.
Program:
CLD ; clear the Direction Flag
MOV AX, 0000H;
MOV DS, AX ; Initialize DS
MOV ES, AX ; Initialize ES
MOV SI, 5000H ; Set source pointer
MOV DI, 6000H ; Set destination pointer
MOV CX, 0003H ; Set length of the string
REPE ; cx=cx-1, if ZF=1 repeat the same maximum CX time
CMPSB ; Compare with source to destination byte set flags according
the result, if DF=0 increment the SI and DI
INT 3
Result: After the execution of the program, if both the strings are completely equal, i.e
CX becomes zero, the ZF is SET, and otherwise ZF is RESET.

D15
D0


Over flow Zero
Direction Sign Parity
Interrupt
Trap Auxiliary carry Carry

Questions:
1. Write an ALP to search a byte in a given string using SCANSB instruction.
2. What are REP, REPE, REPNE prefix instructions? What is its use?
22

14. AIM: WRITE AN ASSEMBLY LANGUAGE PROGRAM FOR PACKED BCD
TO UNPACKED BCD
Apparatus: 8086 kit, power supply.
Procedure / Algorithm:
1. Set data segment and source pointer
2. Get number into two registers
3. Mask off upper nibble.
4. Increment pointer.
5. Place register value in the memory.
6. Get lower nibble into memory.
7. Mask off lower nibble
8. Rotate four times right.
9. Increment pointer.
10. Store the result in memory.
Program:
MOV AX, 0000H Data:
MOV DS, AX; To initialize data segment 0000:5000: 43
MOV SI, 5000; Set pointer Result:
MOV AL, [SI];Get number into AL 0000:5001: 03
MOV BL, AL; as well as in to BL 0000:5002: 04
AND AL, 0FH; Mask upper nibble
INC SI; Increment pointer
MOV [SI], AL; Place least significant digit in memory
AND BL, 0F0H;Mask lower nibble
MOV CL, 04;Set count for number of rotations
ROR BL, CL; Rotate contents of BL
INC SI; Increment pointer
MOV [SI], BL; Place most significant digit in memory location
INT 3; Break Point
Questions:
1. What is the difference between SHR & SAR?
2. Write an ALP for combining least significant bits of memory locations 6000H &
6100H. Store the result in 6002H.
3. Write an ALP to clear the memory locations 6010H & 601FH.

23

15. AIM: WRITE AN ALP TO FIND THE NUMBER OF LOGIC 1S IN A
BYTE.
Apparatus: 8086 Kit, Power Supply
Procedure:
1. Set count value to 08.
2. Set one of the registers to 00 for storing number of 1s.
3. Load number into one of the registers.
4. Rotate left the contents of the register.
5. Check the carry flag.
6. If the carry flag is set then increment register otherwise go to step 3.
7. Decrement count register.
8. If count = 0 then stop the program, otherwise go to step 4.
9. Stop the program.

Program: Data:
MOV AX,0000 Input
MOV DS,AX 0000:4200 : 57
MOV SI,4200H
MOV CL,08 Result
MOV BL,00 0000:4201 : 05
MOV AL,[SI]
L2:ROL AL,01
JNC L1
INC BL
L1:LOOP L2
INC SI
MOV [SI],BL
INT 3

Questions:
1. Modify the above program to find the number of zeros in a given byte.
2. Write the above program using loop instruction.
3. Explain NOT & NEG instructions in 8086.
24


16. AIM: TO WRITE AN ALP FOR THE ADDITION OF A SERIES OF
BYTES FROM A GIVEN ARRAY. THE SERIES CONTAINS 10 BYTES.
Apparatus: 8086 Kit, Power supply
Procedure / Algorithm:
1. Set the data segment and source pointer.
2. Set sum to zero.
3. Set counter
4. Add the contents specified by the pointer to the variable sum and store the sum in
the same variable.
5. Increment pointer and decrement counter.
6. If count is zero then total = sum, otherwise go to step 4.
7. Stop the program.
PROGRAM: DATA
MOV AX, 0000H; Initialize data segment 0000:6000 01
MOV DS, AX; 0000:6001. 01
MOV CX, 0AH; set counter 0000:6002. 01
XOR AX, AX; set sum = 0 0000:6003. 01
MOV SI, 6000H; set pointer 0000:6004. 01
AGAIN: MOV BL, [SI]; Take the first number 0000:6005. 01
ADD AL, BL 0000:6006. 01
ADC AH, 00H; 0000:6007. 01
INC SI; Increment pointer 0000:6008. FF
DEC CX; Decrement count 0000:6009. FF
JNZ AGAIN; count is not zero do the same RESULT
MOV [SI], AL; Store the sum 0000:600A 06
INC SI 0000:600B 02
MOV [SI], AH; Store the carry
INT 03H; Break point

Questions:
1. Explain function of DAA instruction.
2. Modify above program for decimal addition.
3. Write an ALP for decimal addition & decimal subtraction.
25


17. AIM: WRITE A PROGRAM TO FIND THE LARGEST NUMBER FROM A
GIVEN ARRAY OF NUMBERS STORED IN THE LOCATIONS STARTING
FROM A KNOWN ADDRESS.

Apparatus: 8086 Kit, Power supply
Procedure / Algorithm:
1. Set data segment and pointer
2. set max=0 and counter = desired count value
3. is max > [pointer], if yes decrement count. If no increment pointer
4. if count = 0result = max, if no go to step 3
5. result = max
6. Stop the program.

Program: Data:
MOV AX, 0000H 0000:5000 09
MOV DS, AX 0000:5001 03
MOV SI, 5000H 0000:5002 54
MOV CX, 0005H 0000:5003 65
L2: CMP AL, [SI] 0000:5004 02
JNC L1 Result
MOV AL, [SI] 0000:5005 65
L1: INC SI
LOOP L2
MOV [SI], AL
INT 03H







26



18. . AIM: WRITE A PROGRAM FOR CODE CONVERSION
(a) BCD to Binary
(b) Hexadecimal to ASCII

Apparatus: 8086 kit, power supply


Algorithm/ Procedure: BCD to Binary Program:
1. Set data segment and pointer MOV AX, 0000H
2. Take number to AL. MOV DS, AX
3. Keep a copy in AH Register. MOV SI, 5000H
4. Mask off upper nibble. MOV AL, [SI];
5. Keep least significant nibble in CH Register. MOV AH,AL
6. Get byte from CL to AL. AND AL, 0FH; Mask off upper nibble
7. Mask off lower nibble. MOV BL, AL;
8. Rotate AL content 4 times right. MOV AL, AH;
9. Multiply AL content with 0Ah. AND AL, 0F0H; Mask off lower nibble
10. Add CH content to AL. MOV CL, 04H;
11. Store the result. ROR AL, CL; Rotate AL content 4 times
12. Stop the program. MOV CH, 0AH;
MUL CH;
ADD AL,BL;
INC SI
MOV [SI],AL; Store the result
INT 3; Break point

















27

This program converts hexadecimal no: 00 to FF only

Hexadecimal to ASCII conversion MOV AX,0000
1. Set data segment and pointer MOV DS,AX
2. Take number to AL. MOV SI,4100H
3. Keep a copy in AH Register. MOV AL,[4100H]
4. Mask off upper nibble. MOV AH,AL
5. Compare number with 09 AND AL,0FH
6. If AL >09 ; AL = AL+07 or AL=AL CALL CONVT
7. AL= AL+30 = ASCII value of lower nibble XCHG AL,AH
8. Take number and mask lower nibble MOV CL,04
9. Similarly convert the as above AND AL,0F0H
10. Store the value in memory ROR AL,CL
Data CALL CONVT
0000:4100 FF h MOV [4101H],AX
0000:4101 46 INT 3
0000:4102 46 CONVT: CMP AL,09
JNC AGAIN
Data ADD AL,30H
0000:4100 01 JMP GO
0000:4101 30 AGAIN: ADD AL,07
0000:4102 31 ADD AL,30H
GO:RET

Questions: Modify the above programs for converting ASCII to Hexadecimal code.















28

19. AIM: WRITE AN ALP TO SEARCH A GIVEN ITEM FROM THE LIST
USING LINEAR SEARCH TECHNIQUE.

Apparatus Requires: 8086 kit, Power Supply


Program: Data:
MOV AX, 0000H; 0000:5000 86
MOV DS, AX; Initialize Data Segment Register 0000:5001 93
MOV CX, 0007H; Count of number of elements 0000:5002 34
MOV SI, 5000H; Set pointer 0000:5003 45
MOV DL, 01; loc=1 0000:5004 XX
MOV AL,XX ; Number to be searched 0000:5005 87
BACK: CMP AL, [SI]; 0000:5006 64
JZ AHEAD; If number found, stop
INC SI;
INC DL;
LOOP BACK; Result:
AHEAD: MOV [5020], DL; Result location 0000:5020 05 Location
INT 03h;
Questions:
1. Write an ALP to search a given item from the list using Binary Search technique.
2. Write an ALP for searching using string instructions.








29

20. WRITE AN ALP TO ADD TWO MULTI-BYTE NUMBERS AND STORE
THE RESULT AS A THIRD NUMBER. (The numbers are stored in the form
of byte list as the lowest byte is first.)

Apparatus: 8086 trainer kit and power supply.
Algorithm:
Initially set segment and two index register to two given multi-byte number, base
pointer to result, accumulator, carry flag and count register. Copy the first byte from
source index to source register, add with carry of source register and first byte from
destination index. Copy the result from source register to base pointer. Every time
increment the base pointer for storing the result, loop continue till count is zero.
Finally check carry flag and store in base pointer location.

Program:
MOV AX, 0000 Data:
MOV DS, AX; set data segment to 0000 41 4100 A9 87 65 43 21 I
st
No.
MOV CX, 05; CX is counter 44 4105- FE DC BA 98 76 II
nd
No.
MOV SI, 4100H; first multi byte number 41 410A-01 A8 64 1F DB 97 Result
MOV DI, 4105H; second multi byte number
MOV BX, 410Ah; result multi byte number
XOR AX, AX; clear sum and carry flag
CLD index register auto increment
NEXT: LODSB; load AL from SI
ADC AL, [DI]; add with carry = AL + [DI]
MOV BYTE PTR [BX], AL; sum copy to [BX]
INC BX
INC DI
LOOP NEXT; loop continues up to CX is zero
JNC AHEAD; if carry flag is set after adding
MOV BYTE PTR [BX], 01; the end bytes, copied in
[BX]
AHEAD: INT 03h; halt.


30

21 SORTING GIVEN HEXADECIMAL NUMBERS

Apparatus: 8086 trainer kit and power supply.
INPUT 0D 0C 0B 0A
Sorting STEP-1 0C 0B 0A 0D
STEP-2 0B 0A 0C 0D
STEP-3 0A 0B 0C 0D

Programe
MOV AX,0000 INPUT
MOV DS,AX 4200 04
MOV SI,4200H Count n 4201 0D
MOV BL,[SI] 4202 0A
DEC BL Outer n = n-1 4203 0C
OUTL00P: MOV CL,BL Inner n = n-1 4204 0B
MOV SI,4201H
INL00P: MOV AL,[SI]
INC SI
CMP AL,[SI] sort
JC PROCEED OUTPUT
XCHG [SI],AL 4201 0A
MOV -1[SI],AL 4202 0B
PROCEED: LOOP INL00P 4203 0C
DEC BL 4204 0D
JNZ OUTL00P
INT 3







31

22. Aim: To interface a PROGRAMMABLE TIMER 8253 to 8086 and generate a
SQUARE WAVEFORM of period 1ms.
(Mode 3) f = 1KHz

0000:4000 BA CF FF MOV DX,0FFCF Control word
0000:4003 B0 36 MOV AL,36h 0 0 1 1 0 1 1 0 = 36
0000:4005 EE OUT DX,AL
0000:4006 BA C9 FF MOV DX,0FFC9 Counter 0
0000:4009 B0 88 MOV AL,88h 16 bit count
0000:400B EE OUT DX,AL
0000:400C B0 13 MOV AL,13h Mode 3
0000:400E EE OUT DX,AL Binary count
0000:400F CC INT 3

8086 Clock f = 5 M Hz O/P
Desired square wave f = 1K Hz
Count = 5 M Hz / 1K Hz 1 ms
= 5000 D = 1388 H
RATE GENERATOR
(Mode 2)
0000:4000 BA CF FF MOV DX,0FFCF
0000:4003 B0 14 MOV AL,14
0000:4005 EE OUT DX,AL
0000:4006 BA C9 FF MOV DX,0FFC9
0000:4009 B0 05 MOV AL,05
0000:400B EE OUT DX,AL
0000:400C CC INT 3








Control word 0 0 0 1 0 1 0 0

Counter 0

byte count


Mode 2 1- clock period

Binary count
32


SDA -86 - MEL
8253 ADDRESSES

Timer /Counter 0 : FFC9
Timer /Counter 1 : FFCB
Timer /Counter 2 : FFCD
Control Word Reg. : FFCF



























CLK
8086
A
2

A
1


I

/O RD

I/O WR

D0 to D7
Vcc


CLK
0

OUT
0

A
1

A
2

RD GATE
0

WR
CS
To CRO



+5 V

8253
33

23. Aim: Read the analog voltage and display in digital using A/D CONVERTOR
Apparatus: 8086 kit, power supply , ADC module, 26-pin FRC Connector.

MOV AL,90H set 8255 Port A I/P,
MOV DX,0FFC6 port B&C is O/P mode
OUT DX,AL
MOV AL,07 channel Selection
MOV DX,0FFC4H Channel 07
OUT DX,AL
MOV DX,0FFC6 BSR Mode
MOV AL,0EH Start of Conversion(SOC) = 0
OUT DX,AL
MOV AL,0CH Output Enable(0E)= 0
OUT DX,AL
MOV AL,0FH SOC =1
OUT DX,AL
MOV CX,3FFFH delay
L1: LOOP L1
MOV AL,0EH SOC = 0
OUT DX,AL
MOV DX,0FFFC0
WAT:IN AL,DX to Check for End of Conversion
AND AL,80 (EOC)i.e. conversion is
ROL AL,1 completed or not
JNC WAT

0 X X X 1 1 0 0

0 X X X 1 1 1 1

0 X X X 1 1 1 1

1 0 0 1 0 0 0 0

34




A
2
A
1

8086

I/ORD

I/OWR
D
0
to D
7
PC
2

PC
1

PC
0




A
1
PA
7
A
0
PC
7
RST

RD PC
6


WR
8
2
5
5

A
N
A
L
O
G

I
N
P
U
T
S


V
ref +
V
ref -

EOC
ALE
0809
SOC

OE
A
2
A
1
A
0

PA
0-
PA
7
to O
0
O
7

CH 00







CH 07




00 to 5V DC

8086 Interfacing with ADC0809 through PPI8255
Questions: Kit No: NIFC 07A, Channel No.08
1. Explain the different modes of operation of 8255.
2. Explain the Control Word format of 8255 in I/O and BSR mode.
3. What is the function of ADC 804 IC?






MOV DX,0FFC6H to enable the output to
MOV AL,0D be read by the processor
OUT DX,AL 0E = 1
MOV DX,0FFC0
IN AL,DX Read the digital
INT 3 data in AL register
8255 PORT ADDRESSES 5V = FF h (255)
PORT A FFC0H 1V = ?
PORT B FFC2H 1V = 255/5V =(51)
d
=(33)
h
PORT C FFC4H 2V = 66h, 3V = 99h
CWR FFC6H 4V = CCh, 5V = FFh





















0 X X X 1 1 0 1

35


FF



00 f = 1/T
T

24. Aim: Write an ALP to generate SQUARE WAVE USING DAC module.
Apparatus: 8086 kit, power supply unit, DAC module, 26-pin FRC Connector, CRO.
Description:
1. Use Port A of 8255 in output mode and write control word of 8255 into control
word register in simple I/O mode for data transfer.
2. Send high value to Accumulator.
3. Send Accumulator value to port A.
4. Call delay sub-routine.
5. Send low value to Accumulator.
6. Send accumulator value to the port.
7. Call delay sub-routine.
8. Jump to Step 2, for continues square wave generation.
( 8-Bit Digital to Analog Converter) through 8255 PPI
0000:4005 B0 50 MOV AL,80
0000:4007 BA C6 FF MOV DX,0FFC6
0000:400A EE OUT DX
0000:400B BA C0 FF MOV DX,0FFC0
0000:400E B0 00 Rpt MOV AL,00
0000:4010 EE OUT DX
0000:4011 E8 CALL DELAY
0000:4014 B0 FF MOV AL,FF
0000:4016 EE OUT DX
0000:4017 E8 CALL DELAY
0000:4020 EB JMP Rpt

Delay program
0000:4022 B9 FF 00 MOV CX,00FF
0000:4025 E2 here LOOP here
0000:4027 C3 RET

DELAY CALCULATION:
CLOCK CYCLES
MOV CX,COUNT 4
HERE: LOOP HERE 17/5
RET 8

DELAY: (N0. of clock cycles) X one clock period
1 K Hz = (4 + (count X 17) 12 + 8) X
Count = 1 K Hz/(17 X 0.2s )





1 0 0 0 0 0 0 0

I/O Port A Port A Port B,C
Mode Mode 0 O/P Output Ports

36

Interfacing Diagram:






Triangular wave generation
0000:4005 B0 80 MOV AL,80

0000:4007 BA C6 FF MOV DX,FFC6
0000:400A EE OUT DX
0000:400B BA C0 FF MOV DX,FFC0
0000:400E B0 00 Repeat: MOV AL,00
0000:4010 EE Rise: OUT DX
0000:4011 FE C0 INC AL
0000:4013 3C FF CMP AL,FF
0000:4015 75 JNZ Rise
0000:4017 FE C8 Decay: DEC AL
0000:4019 EE OUT DX
0000:401A 3C 00 CMP AL,00
0000:401C 75 JNZ Decay
0000:401E EB JMP Repeat














I
ORD
RD

I
OWR
WR

A
2
A
1
A
1
A
0

D
0
to D
7
8
0
8
6

8
2
5
5

cs
PORT A


B
0
to B
7 2.5K + 5 V

5K


V
0
741
O/P to CRO



+5 V
or
12 V

D
A
C

0
8
0
0

1
3



















1
4

FF



00

T = Time period f = 1/T
37

Sin wave Generation
0000: 4000 MOV AL,80
0000: 4002 BA C6 FF MOV DX,0FFC6
0000: 4004 EE OUT DX,AL
0000: 4005 BA C0 FF MOV DX,0FFC0
0000:4008 FC CLD
0000:4009 B1 18 cont MOV CL,18
0000:400B BE 50 41 MOV SI,4150
0000:400E 8A 04 next LODSB
0000:4010 EE OUT DX,AL
0000:4011 E2 F8 LOOP next
0000:4013 EB F0 JMP cont

Lookup table
S.No Address Decimal Hex
01. 4150 128 80
02. 4151 160 AD
03. 4152 192 C0
04. 4153 217 D9
05. 4154 238 EE
06. 4155 251 FB
07. 4156 255 FF
08. 4157 251 FB
09. 4158 238 EE
0A. 4159 217 D9
0B. 415A 192 C0
0C. 415B 160 A0
0D. 415C 128 80
0E. 415D 96 60
0F. 415E 64 40
10. 415F 37 25
11. 4160 17 11
12. 4161 4 04
13. 4162 0 00
14. 4163 4 04
15. 4164 17 11
16. 4165 37 25
17. 4166 64 40
18. 4167 96 60
19. 4168 128 80






38

25. Aim: To INTERFACE 7-SEGMNET LED DISPLAY to 8086.

Apparatus: 8086 kit, power supply
Interfacing Diagram:








Address CA CC BCD Display
4100 C0 3F 00 0
4101 F9 06 01 1
4102 A4 5B 02 2
4103 B0 4F 03 3
4104 99 66 04 4
4105 92 6D 05 5
4106 82 7D 06 6



MOV AL, 80H
MOV DX, FFC6
OUT DX, AL
MOV DX, FFC0
CLD
REPEAT: MOV SI, 4100
MOV BL, 07H
NEXT: LODSB
OUT DX, AL
CALL DELAY
DEC BL
JNZ NEXT
JMP REPEAT
DELAY: MOV CX,FFFF
HERE: LOOP HERE
RET



FRC cable




7-seg display


CC= Common Cathode
PA 0=a
PA 5=f PA 1=b

PA 6=g

PA 4=e PA 2=c

PA 3=d PA 7=h









FRC cable 7447 Pin Diagram






CA = Common Anode
CC= Common Cathod
BCD to 7 -Segment



8255


8086
PA
7
- PA
0

D
0
- D
7


8086


8255





P
A
0
-

P
A
3

D
0
- D
7
7447
BCD to 7-segment

39

26. Aim: To INTERFACE STEPPER MOTOR to 8086.
Apparatus: 8086 kit, power supply, Stepper motor, stepper motor interface board.
Theory:
A stepper motor is a device used to obtain an accurate position control of rotating
shafts. A stepper motor employs rotation of its shaft in terms of steps rather than
continuous rotation as in case of AC or Dc motors. To rotate the shaft of the stepper
motor, a sequence of pulses is needed to be applied to the windings of the stepper
motor, in proper sequence. A popular scheme for rotation of a stepper motor shaft
applies pulses to two successive windings at a time but these are shifted only by one
position at a time. This scheme for rotation of stepper motor is shown in the following
figure and table.

ROTATING STEPPER MOTOR SHAFT
MOTION STEP Code Winding 1 Winding 2 Winding 3 Winding 4
Clock wise
step angle 1.8
0
(full step)
1 03 0 0 1 1
2 06 0 1 1 0
3 0C 1 1 0 0
4 09 1 0 0 1

Anti-clock
wise
step angle 1.8
0
(full step)
1 03 0 0 1 1
2 09 1 0 0 1
3 0C 1 1 0 0
4 06 0 1 1 0

Step angle
0.9
0
(half step)
1 0C 1 1 0 0
2 09 1 0 0 1
3 03 0 0 1 1
4 06 0 1 1 0
5 08 1 0 0 0
6 01 0 0 0 1
7 02 0 0 1 0
8 04 0 1 0 0

40

The stepper motor connections for the four windings can be shown as follows:

Program:
MOV DX, 0FFC6H
MOV AL, 80H
OUT DX, AL
MOV DX, 0FFC0H
CONT: MOV AL, 33H; 33, 99,CC,66
NEXT: OUT DX, AL
CALL DELAY
ROL AL, 1 (for anti-clock rotation ROR AL, 1)
LOOP NEXT
JMP CONT

DELAY MOV CX, 0FFH (for decrease the speed 0FF to 0FFFH)
HERE: LOOP HERE
RET

KIT MOTOR
PA
0
=13 ORANGE GREEN
PA
1
=10 BLUE RED
PA
2
=07 YELLOW YELLOW
PA
3
=04 BROWN ORANGE



PA
0
PA
1
PA
2
PA
3




41

27. Aim: To interface a 3*8 KEYBOARD with 8086 using 8255 and write an ALP
for detecting a key closure and return the key code in AL. The debouncing period of
a key is 10ms. Use software key debouncing technique. DEBOUNCE is an available
10ms delay routine.
Apparatus: 8086 kit, power supply, key-board module.


Solution: Port C is used as output port for selecting row of keys while port A is used as
input port for sensing a closed key. Thus the key boards lines are selected one by one
through Port C and Port A lines are hold continuously till a key closure is sensed. Then
routine DEBOUNCE is called for key debouncing. The Key code is decided depending
upon the selected row and a low sensed column. The hardware circuit diagram is shown
in the figure.



Figure: Interfacing 3*8 keyboard

42

The port A and port C lower are used. The addresses of port A and C will be
respectively FFC0H and FFC4h while the address of CWR is FFC6h. The flowchart
of the entire program is given in the following figure.






43

Program:
MOV AL,90H Port A I/P, Port B&C O/P
MOV DX,0FFC6H Control Word Register
OUT DX,AL
MOV BL,00 initialize key code counter
MOV AL,0FFH making all rows high
MOV DX,0FFC4H Port C
OUT DX,AL
MOV DX,0FFC0H Port A
WAIT: IN AL,DX Reading Columns Port A
CMP AL,00
JZ WAIT
CALL DEBOUNCE
MOV BH,03 To high no of rows
MOV AL,80H
NXROW: ROL AL,1H Row 1=0
MOV CH,AL
MOV DX,0FFC4H Checking row 0
OUT DX,AL
MOV DX,0FFC0H
IN AL,DX Reading columns
MOV CL,08H
NEXT: ROR AL,1H Checking for key press
JC KEYCOD
INC BL
DEC CL Checking for key press in the
column JNZ NEXT
MOV AL,CH
DEC BH Next row
JNZ NXROW
JMP WAT

KEYCOD: MOV AL,BL
INT 3

DEBOUNCE: MOV CX,094C H 10ms 0F 5Mhz frequence
L1: NOP
DEC CX
JNZ L1
RET

Result: In AL register





44

28. Aim: Interface single LED blinking with 8255(BSR Mode)

Apparatus: 8086 kit, power supply, key-board module, 26 pin connector with FRC
& LED.

Single LED interfacing
0000: 4000 B0 80 MOV AL,80
All ports are O/P
CWR
0000: 4002 BA C6 FF MOV DX,0FFC6
0000: 4004 EE OUT DX,AL
0000: 4005 B0 0F cont MOV AL,0F Port C
7
th
bit is high 0000:4008 EE OUT DX
0000:4009 E8 CALL DELAY
0000:400C B0 0F MOV AL,0E Port C
7
th
bit is low 0000:400E EE OUT DX
0000:400F E8 CALL DELAY
JMP cont
DELAY
0000: 4010 B9 FF FF MOV CX,0FFFF
0000: 4013 F2 FE here LOOP here
0000: 4015 C3 RET














AD
0
- AD
7


8086

IORD

IOWR

A
2

A
1


D
0
- D
7
PC
7

8255

RD

WR

A
1

A
0
CS


45




29. Aim: Digital I/O Interfacing.

Apparatus: 8086 kit, power supply, key-board module, 26 pin connector with FRC
& Digital I/O module.

Circuit diagram:
















Program
0000: 4000 B0 82 MOV AL,82 PA - O/P &PB-I/P
0000: 4002 BA C6 FF MOV DX,0FFC6
CWR address 0000: 4004 EE OUT DX,AL
0000: 4005 BA C2 FF cont MOV DX,0FFC2 PB address
0000:4008 EC IN AL,DX
0000:4009 BA C0 FF MOV DX,0FFC0 PA address
0000:400B EE OUT DX,AL
0000:400E EB F0 JMP cont



AD
0
- AD
7


8086

IORD

IOWR

A
2

A
1


D
0
- D
7
PB
0-7


8255
RD

WR

A
1
PA
0-7

A
0
CS


Digital I/O module

+12V
46

30. Interfacing 8 LED with 8051.

Apparatus: 8051 kit, power supply, key-board module, 10 pin connector with FRC
& LED module.

Circuit diagram:

















Program:
8000 74 55

MOV A,#55 Load the into register (0101 0101)
8002 F5 90
CONT
MOV 90, A Load data from Register to P1
8004 F4

CPL A Compliment the register A contents
8005 11 09

ACALL DELAY Call delay subroutine
8007 01 02

AJMP CONT Jump unconditionally



8009 7F FF
Delay
MOV R7, #0FF Load the data to register R7
800B 7E FF
L2
MOV R6, #FF Load the data to register R6
800D DE FE
L1
DJNZ R6, L1 Decrement Register by one & jump
on no zero condition to address 800F DF FA

DJNZ R7, L2
8010 22

RET Resume to called program













P 1.0-7


8051
R
S
R
S
LED
LED
47

31. Interface stepper motor with 8051.

Apparatus: 8051 kit, power supply, key-board module, 10 pin connector with
FRC, ULN2003 & stepper motor.

Circuit diagram:














Program:
8000 74 55

MOV A,#33 Load the into register (0011 0011)
8002 F5 90
CONT
MOV 90, A Load data from Register to P1
8004 F4

RR A Rotate register contents 66,99,CC,33
8005 11 09

ACALL DELAY Call delay subroutine
8007 01 02

AJMP CONT Jump unconditionally



8009 7F FF
Delay
MOV R7, #0FF Load the data to register R7
800B 7E FF
L2
MOV R6, #0FF Load the data to register R6
800D DE FE
L1
DJNZ R6, L1 Decrement Register by one & jump
on no zero condition to address 800F DF FA

DJNZ R7, L2
8010 22

RET Resume to called program

















P 1.0-3


8051
+12 V
U
L
N
2
0
0
3


Stepper
Motor
48

32. Interfacing seven segment LED with 8051

Apparatus: 8051 kit, power supply, key-board module, 10 pin connector with
FRC, & 7-seg LED.









































P
0-7

8051
49

STUDY OF MASM


1. To study the various directives of Macro Assembler.
2. Switch on the computer, and go to DOS window displaying the C prompt
i.e. cd\ enter C :\>
3. Open MASM directory C:\CD MASM enter
4. C:\>MASM>edit file_name.asm
5. Then the program is to be loaded in to the file. After entering, the program is to be
saved using same method.
6. Alt + f are to be pressed. The monitor lists the commands. Enter Exit command
and press Enter key.
7. Monitor displays C prompt C:\MASM.
8. Enter
C:\>MASM>masm file_name.asm and then press enter key. Press enter 4 times, it
shows 0 warning errors
0 severe errors
C:\masm>
9. Enter the following command
C:\>MASM>link file_name.obj and then press enter key 4 times, it shows
C:\masm>

10. Then
C :\> MASM> debug file_name.exe and then press enter key.
11. Monitor then displays a hyphen -
Debug the program line by link t (Trap) and press enter key.
<t> <enter> ..Program executes line by line.
12. R is to be pressed to get the register contents.
13. G is to be pressed for entire program execution.
14. D is to be pressed to get the data in memory locations.
Ex: d segment address : offset address (d 1039:0000 enter)
15. u is to be pressed to get the entire program with addresses, op-codes &
mnemonics
16. Q is to be pressed to return to DOS prompt.


50

MASM (Macro Assembler) Programs
25. Aim: To display a message The study of microprocessors is interesting. on the CRT
screen.
Apparatus: PC, MASM (Macro Assembler) Software Tool

Program:

ASSUME CS: CODE, DS: DATA
DATA SEGMENT
MESSAGE DB 0DH, 0AH, STUDY OF MICROPROCESSORS IS INTERESTING.,
0DH, 0AH, $
DATA ENDS

CODE SEGMENT
START: MOV AX, DATA
MOV DA, AX
MOV AH, 09H
MOV DX, OFFSET MESSAGE
MOV AH, 4CH
INT 3
CODE ENDS
END START












51

1. Write instructions to find the product of two BCD numbers.
ASSUME CS:CODE, DS:DATA
DATA SEGMENT
NUM1 DB 45H;
NUM2 DB 22H;
PRO DW ??
DATA ENDS

CODE SEGMENT
START:
MOV AX, DATA;
MOV DS, AX; Initialize Data Segment
MOV AL, NUM1; First BCD number to AL
CALL BCDTOBIN; Call the subroutine to convert BCD to Binary
MOV CL, AL; save in CL
MOV AL, NUM2; second BCD number to AL
CALL BCDTOBIN; call the subroutine to convert BCD to binary
MUL CL; compute the product
MOV PRO, AX; Store the product
BCDTOBIN:
PUSHF; Save the flags
PUSH BX; save BX
PUSH CX; save CX
MOV BL, AL; copy the BCD number to Bl
AND BL, 0F; separate the BCD number into two nibbles
AND AL, 0F0H
MOV CL, 04
ROR AL, CL
MOV CH, 0A; convert the MSB digit of BCD number to binary
MUL CH
ADD AL, BL; add the LSB digit and hold binary value in AL
POP CX; restore CX
POP BX; restore BX
POPF; restore flags
RET; return to main program

CODE ENDS
END START




52


2. Program to compare two strings.

MYDATA SEGMENT
STRING1 DB PASSWORD; first string
STRING2 DB PASSWORD; second string
LENGTH DW 0008H; the length of the string
RESULT DB 1 DUP(0); space to indicate result
MYDATA ENDS

MYCODE SEGMENT
ASSUME CS:MYCODE, DS:MYDATA
START: MOV AX, MYDATA; initialize DS and Es
MOV DA, AX
MOV ES, AX
MOV CX, LENGTH ; Load length of the string in CX
MOV SI, OFFSET STRING1; point SI to first string
MOV DI, OFFSET STRING2; point DI to second string
CLD; clear direction flag to auto increment SI and DI
REPE CMPSB; Repeat comparison until the end of string or until compared bytes are not
equal
JNZ L1;
MOV RESULT, 0FFH;Store FF if the two strings are equal
INT 03H;Terminate the program
L1: MOV RESULT, 00H; store 00 if the two strings are not equal
INT 03H; Terminate the program
MYCODE ENDS
END START






53
























Address
Inputs
CA

DISPLAY
DATA
4100 CC BCD
4101 C0 3F 01 0
4102 F9 06 02 1
4103 A4 5B 03 2
4104 99 66 04 3
4105 92 6D 05 4
4106 82 7D 06 5
F8 07 07 6

You might also like