0% found this document useful (0 votes)
4 views33 pages

Cse Lab Update

The document is a Microprocessor Lab Manual for B.Tech CSE 5th Semester, detailing various experiments involving assembly language programming (ALP) on an 8086 trainer kit. It includes a list of experiments such as addition, subtraction, multiplication, and division of hexadecimal numbers, along with specific algorithms and sample programs for each task. Each experiment outlines the aim, apparatus, algorithm, program code, inputs, outputs, and results, demonstrating the execution of arithmetic operations using assembly language.

Uploaded by

yeeshandas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views33 pages

Cse Lab Update

The document is a Microprocessor Lab Manual for B.Tech CSE 5th Semester, detailing various experiments involving assembly language programming (ALP) on an 8086 trainer kit. It includes a list of experiments such as addition, subtraction, multiplication, and division of hexadecimal numbers, along with specific algorithms and sample programs for each task. Each experiment outlines the aim, apparatus, algorithm, program code, inputs, outputs, and results, demonstrating the execution of arithmetic operations using assembly language.

Uploaded by

yeeshandas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

MICROPROCESSOR LAB MANUAL

B.Tech CSE 5th Sem

List of Experiments:

1. To perform addition of two 8 – bit hexadecimal numbers.

2. To perform addition of two 32 – bit hexadecimal numbers

3. To perform subtraction of two 8 – bit hexadecimal numbers

4.To perform subtraction of two 16 – bit hexadecimal numbers.

5. To perform subtraction two 32 – bit hexadecimal numbers.

6. To perform multiplication of two 8 bit nos and two 16 bit nos.

7. To perform division of 16 – bit number with 8-bit number.

8. To write an ALP (8086) to evaluate given arithmetic expression

is f = (a+b) (b+c) (c+d) (a+b+c+d)

9. To write a program to perform the string operation for sorting

a string in an ascending order and descending order.

10. To find largest & smallest byte from block of data.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 1


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 1

Sum of given ‘n’ 8-bit numbers

AIM: To write an ALP (8086) to find out the sum of given ‘n’ 8-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Clear the AX and BX registers.
5. Take the count value into CL register.
6. Copy the offset address of numlist and move the first value into BL.
7. Perform repeated addition till the count value becomes zero.
8. Store the sum in the offset address defined for RESULT in data segment.
9. Terminate the program.
10. Stop
PROGRAM:
. MODEL SMALL
. STACK
. DATA
COUNT EQU 6d
NUMLIST DB 19h,29h,39h,49h,59h,99h
RESULT DW 01h DUP (?)
. CODE
MOV AX, @DATA
MOV DS, AX

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 2


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
XOR AX, AX
XOR BX, BX
MOV CL, COUNT
MOV SI, OFFSET NUMLIST
AGAIN: MOV BL, [SI]
ADD AX, BX
INC SI
DEC CL
JNZ AGAIN
MOV DI, OFFSET RESULT
MOV [DI], AX
INT 21h
END

INPUT: 19h, 29h, 39h, 49h, 59h, 99h

OUTPUT: 01B6H

RESULT: Thus the sum of given ‘n’ 8-bit numbers has been executed successfully and the result
is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 3


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 2
Multi word Addition

AIM: To write an ALP (8086) to perform the addition of two 32-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. LSW of 1st operand is moved to AX register.
3. LSW of 2nd operand is moved to BX register.
4. Add the contents of AX and BX registers and the result is stored in AX register.
5. Copy the LSW of result present in AX register into CX register.
6. MSW of 1st operand is moved to AX register.
7. MSW of 2nd operand is moved to BX register.
8. Add the contents of AX and BX registers along with carry (obtained from previous addition)
and the result is stored in AX register.
9. Copy the MSW of the result present in AX register into DX register.
10. Terminate the program.
11. Stop

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 4


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
PROGRAM:
. MODEL SMALL
. STACK
. DATA
. CODE
MOV AX, 0F000h
MOV BX, 1000h ADD
AX, BX MOV CX, AX
MOV AX, 5678h
MOV BX, 1234h

ADC AX, BX MOV


DX, AX
INT 21h
END

INPUT 1: 5678F000h

INPUT 2: 12341000h

OUTPUT: DX: CX=68AD0000h

RESULT: Thus the program for addition of two double words has been executed successfully by
using TRAINER KIT and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 5


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO :3
ALP for Subtraction of two 8-bit numbers
AIM: To write an ALP (8086) to find out the subtraction of given ‘n’ 8-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Clear the AX and BX registers.
5. Take the count value into CL register.
6. Copy the offset address of numlist and move the first value into BL.
7. Perform repeated subtraction till the count value becomes zero.
8. Store the result in the offset address defined for RESULT in data segment.
9. Terminate the program.
10. Stop

PROGRAM:
DATA SEGMENT
VAR1 DB 53H
VAR2 DB 2AH
RES DB?
DATA ENDS
ASSUME CS:CODE,DS:DATA
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AL,VAR1
MOV BL,VAR2
SUB AL,BL

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 6


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
MOV RES,AL
MOV AH,4CH
INT 21H
CODE ENDS
INPUT: AL = 53H, BL= 2A H

OUTPUT:

RESULT: Thus the subtraction of given ‘n’ 8-bit numbers has been executed successfully and the
result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 7


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO :4
ALP for Subtraction of two 16-bit numbers
AIM: To write an ALP (8086) to perform the subtraction of two 16-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. LSW of 1st operand is moved to AX register.
3. LSW of 2nd operand is moved to BX register.
4. Subtract the contents of BX from AX register and the result is stored in AX register.
5. Copy the LSW of result present in AX register into CX register.
6. MSW of 1st operand is moved to AX register.
7. MSW of 2nd operand is moved to BX register.
8. Subtract the contents of BX from AX registers along with borrow (obtained from previous
subtraction) and the result is stored in AX register.
9. Copy the MSW of the result present in AX register into DX register.
10. Terminate the program.
11. Stop

PROGRAM :
DATA SEGMENT

VAR1 DW 8560H
VAR2 DW 3297H
RES DW?
DATA ENDS
ASSUME CS: CODE,DS:DATA
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 8
MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
MOV AX, VAR1
CLC
SUB AX, VAR2
MOV RES, AX

MOV AH, 4CH


INT 21H
CODE ENDS
END START

INPUT 1: 8560 h

INPUT 2:3297h

OUTPUT: AX=

RESULT: Thus the program for subtraction of two words has been executed successfully by using
TRAINER & result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 9


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 5
Multi Word Subtraction

AIM: To write an ALP (8086) to perform the subtraction of two 32-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. LSW of 1st operand is moved to AX register.
3. LSW of 2nd operand is moved to BX register.
4. Subtract the contents of BX from AX register and the result is stored in AX register.
5. Copy the LSW of result present in AX register into CX register.
6. MSW of 1st operand is moved to AX register.
7. MSW of 2nd operand is moved to BX register.
8. Subtract the contents of BX from AX registers along with borrow (obtained from previous
subtraction) and the result is stored in AX register.
9. Copy the MSW of the result present in AX register into DX register.
10. Terminate the program.
11. Stop

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 10


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
. CODE
MOV AX, 0111h
MOV BX, 1000h
SUB AX, BX MOV
CX, AX MOV AX,
5678h MOV BX,
1234h SBB AX, BX
MOV DX, AX INT
21h
END

INPUT 1: 56780111h

INPUT 2: 12341000h OUTPUT:

DX: CX=4443F111h

RESULT: Thus the program for subtraction of two double words has been executed successfully by
using TRAINER & result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 11


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 6(B)

Multiplication of two unsigned 16-bit numbers

AIM: To write an ALP (8086) to perform the multiplication of two unsigned 16-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.


ALGORITHM:
1. Start
2. Copy the first 16 bit operand into AX register.
3. Copy the second 16 bit operand into BX register.
4. Perform unsigned multiplication between the values stored in AX and BX, observe the MSW
of the result present in DX and LSW in AX 5. Terminate the program.
5. Stop
PROGRAM:
. MODEL SMALL
. STACK
. DATA
. CODE
MOV AX, 1234h
MOV BX, 1234h
MUL BX
INT 21h
END INPUT
1: 1234h INPUT 2:
1234h
OUTPUT: DX:AX=014B5A90h

RESULT: Thus the program for multiplication of two 16-bit program executed successfully by
using TRAINER & result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 12


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 6( A)

Multiplication of two 8-bit numbers

AIM: To write an ALP (8086) to perform the multiplication of two 8-bit numbers.

APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. Copy the first 8 bit operand into AL register.
3. Copy the second 8 bit operand into BL register.
4. Perform multiplication between the values stored in AL and BL , observe the MSW of the result
present in DX and LSW in AX.
5. Terminate the program.
6. Stop
PROGRAM:
DATA SEGMENT

VAR1 DB 0EDH
VAR2 DB 99H
RES DW?
DATA ENDS
ASSUME CS: CODE, DS:DATA
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AL, VAR1
MOV BL, VAR2
MUL BL

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 13


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
MOV RES, AX
MOV AH, 4CH
INT 21H
CODE ENDS
END START

INPUT 1: 80h
INPUT 2: 20h
OUTPUT: AX=

RESULT: Thus the program for multiplication of two 8 bit numbers has been executed
successfully by using TRAINER and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 14


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 7

Division of 16-bit/8-bit number (unsigned)

AIM: To write an ALP (8086) to perform the multiword division of 16-bit by 08 bit number.
APPARATUS: 8086 trainer kit, keyboard.

ALGORITHM:
1. Start
2. Copy the 16 bit dividend into AX register.
3. Copy the 8 bit divisor into BL register.
4. Perform division between the values stored in AX and BL, observe the quotient in AL and
remainder in AH.
5. Terminate the program.
6. Stop
PROGRAM:
. MODEL SMALL
. STACK
. DATA
. CODE
MOV AX, 1234h
MOV BL, 58h DIV
BL
INT 21h
END

INPUT 1: 1234h
INPUT 2: 58h
OUTPUT: AL (Q) = 34H AL
(R) =54H

RESULT: Thus the division of 16-bit by 8-bit number program executed successfully by using
TRAINER and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 15


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 8
To evaluate arithmetic expressions
AIM: To write an ALP (8086) to evaluate given arithmetic expression is f = (a+b) (b+c) (c+d)
(a+b+c+d)
APPARATUS: 8086 Tainer kit,keyboard.
ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment through AX register.
4. Copy the variable data a & b into AL & BL and perform the addition between AL & BL.
5. Initialize the starting address of result temporarily with SI register and store the result 1200h
location from the AL register.
6. Copy the variable data b & c into AL & BL and perform the addition between AL & BL.
7. Increment the SI register and store the result 1201h location from the AL register.
8. Copy the variable data c & d into AL & BL and perform the addition between AL & BL.
9. Increment the SI register and store the result 1202h location from the AL register.
10. Copy the variable data a into AL register and perform the addition between AL registers & b.
11. Add the content of AL and c then d to the AL register.
12. Copy the result into BL register from AL register & move the content in 1200h location to AL.
13. Multiply the content in AL with content available in 1201h location then multiply with content
in 1202h location perform the division.
14. Terminate the program.
15. Stop.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 16


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
PROGRAM:
. MODEL SMALL
. STACK
. DATA
A DB 01H B
DB 02H C DB
03H D DB 04H
. CODE
MOV AX, @DATA
MOV DS, AX
XOR AX,AX MOV
AL, A MOV BL, B
ADD AL, BL MOV
SI, 1200H MOV
[SI], AL MOV AL, B
MOV BL, C ADD
AL, BL INC SI
MOV [SI], AL
MOV AL, C MOV
BL, D ADD AL,
BL INC SI
MOV [SI], AL
MOV AL, A ADD
AL, B ADD AL, C
ADD AL, D MOV
CL, AL
XOR AX, AX

MOV AL, [SI] MOV


BL, [SI-1] MUL BL
MOV BL, [SI-2]
MUL BL

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 17


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
MOV BL, CL
DIV BL
INT 21H

INPUT: a=01h, b=02h, c=03h, d=04

OUTPUT: AX = 050Ah

RESULT: Thus the program for given arithmetic expression was successfully executed.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 18


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO :9(A)
Sorting a string in an ascending order

AIM: To write an ALP (8086) to perform the string operation for sorting a string in an ascending
order.

APPARATUS: 8086 Tainer kit,keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Specify the count value for external loop in DX and copy into CX register.
5. Take the offset address of list into SI register.
6. Copy the first number in list into the AL register.
7. Compare the number in AL register with subsequent number and exchange the position of the
numbers depending on result of the comparison.
8. Repeat step7 until the value present in CX register is Zero.
9. Repeat the steps 6,7and 8 until the DX becomes Zero and observe the results in ascending order.
10. Terminate the program.
11. Stop

PROGRAM:
. MODEL SMALL
. STACK
. DATA
LIST DB 53h, 10h, 24h, 12h
. CODE
MOV AX, @DATA
MOV DS, AX
MOV DX, 03h
AGAIN2: MOV CX, DX
MOV SI, OFFSET LIST
RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 19
MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
AGAIN1: MOV AL, [SI]
CMP AL, [SI+1]
JL PR1
XCHG [SI+1], AL
XCHG [SI], AL PR1:
ADD SI, 01h LOOP
AGAIN1
DEC DX
JNZ AGAIN2
MOV AH, 4Ch
INT 21h
END

INPUT: Enter string: 53h, 10h, 24h, 12h


OUTPUT: Sorted String: 10h, 12h, 24h, 53h

RESULT: Thus the program for sorting a string in an ascending order is executed successfully by
using TRAINER and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 20


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 9(B)

Sorting a string in an descending order

AIM: To write an ALP (8086) to perform the string operation for sorting a string in an descending
order.

APPARATUS: 8086 Tainer kit,keyboard..

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Specify the count value for external loop in DX and copy into CX register.
5. Take the offset address of list into SI register.
6. Copy the first number in list into the AL register.
7. Compare the number in AL register with subsequent number and exchange the position of the
numbers depending on result of the comparison.
8. Repeat step7 until the value present in CX register is Zero.
9. Repeat the steps 6,7& 8 until the DX becomes Zero and observe the results in descending order.
10. Terminate the program.
11. Stop.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 21


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
LIST DB 53h, 10h, 24h, 12h
. CODE
MOV AX, @DATA
MOV DS, AX
MOV DX, 03h
AGAIN2: MOV CX, DX
MOV SI, OFFSET LIST
AGAIN1: MOV AL, [SI]
CMP AL, [SI+1]
JG PR1
XCHG [SI+1], AL
XCHG [SI], AL PR1:
ADD SI, 01h LOOP
AGAIN1
DEC DX
JNZ AGAIN2
MOV AH, 4C INT
21h
END

INPUT: Enter string: 53h, 10h, 24h, 12h


OUTPUT: Sorted String: 53h, 24h, 12h, 10h

RESULT: Thus the program for sorting a string in descending order is executed successfully by
Trainer Kit and result is verified.
RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 22
MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 10(A)

Smallest number of a given ‘n’ numbers

AIM: To write an ALP (8086) to determine the smallest number of a given array.

APPARATUS: 8086 Tainer kit,keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Take the offset address of array into SI register.
5. Copy the count value into CL register and clear the AX register.
6. Take the first number in list into AL regiser.
7. Compare the number in AL register with subsequent number and copy the smallest number into
AL register depending on result of the comparison.
8. Repeat step7 until the value present in CL register is Zero.
9. Terminate the program.
10. Stop.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 23


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
LIST DB 02h, 09h, 03h, 06h, 08h, 07
. CODE
MOV AX, @DATA
MOV DS, AX
MOV SI, OFFSET LIST
MOV CL, 05h
XOR AX, AX
MOV AL, [SI]
UP: INC SI
CMP AL, [SI] JB
GO
MOV AL, [SI] GO:
LOOP UP
INT 21h
END

INPUT: 02h, 09h, 03h, 06h, 08h, 07

OUTPUT: AL = 02H

RESULT: Thus the smallest number of a given ‘n’ number program was executed successfully
using TRAINER and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 24


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 10(B)

Largest number of a given ‘n’ numbers

AIM: To write an ALP (8086) to determine the smallest number of a given array.

APPARATUS: 8086 Tainer kit,keyboard.


ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of data segment.
4. Take the offset address of array into SI register.
5. Copy the count value into CL register and clear the AX register.
6. Take the first number in list into AL register.
7. Compare the number in AL register with subsequent number and copy the largest number into
AL register depending on result of the comparison.
8. Repeat step7 until the value present in CL register is Zero.
9. Terminate the program.
10. Stop.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 25


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
LIST DB 02h, 09h, 03h, 06h, 08h, 07h
. CODE
MOV AX, @DATA
MOV DS, AX
MOV SI, OFFSET LIST
MOV CL, 05h
XOR AX, AX
MOV AL, [SI]
UP: INC SI
CMP AL, [SI]
JNB GO
MOV AL, [SI] GO:
LOOP UP
INT 21h
END

INPUT: 02h, 09h, 03h, 06h, 08h, 07

OUTPUT: AL = 09H

RESULT: Thus the largest number of a given ‘n’ number program was executed successfully
using TRAINER and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 26


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
EXPERIMENT NO : 11

Search for a given number

AIM: To write an ALP (8086) to search for a given number in an array.

APPARATUS: 8086 Tainer kit,keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS and ES register with the starting address of data segment.
4. Copy the count value into CL register.
5. Get the offset address of array into SI register and clear the direction flag.
6. Copy the number to be search in AL register and scan repeatedly.
7. If not found display the message BYTE NOT FOUND.
8. If found display the message BYTE FOUND.
9. Terminate the program
10. Stop

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 27


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 12

Converting BCD to ASCII number

AIM: To write an ALP (8086) to convert from BCD to ASCII numbers..

APPARATUS: 8086 Tainer kit,keyboard.

ALGORITHM:
1. Start
2. Move the packed data into BL register and count value into BH register temporarily.
3. Copy the packed BCD data from BL to AL register and count value from BH to CL registers.
4. Perform shift left & rotate right operations by the AL with the count number of times specified.
5. Perform XOR and copy the lower byte of unpacked BCD data to DL register.
6. Copy the packed BCD data from BL to AL register and count value from BH to CL registers.
7. Perform shift right operations by the AL with the count number of times specified.
8. Perform XOR and copy the higher byte of unpacked BCD data to DH register.
9. Terminate the program.
10. Stop

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 28


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
. CODE
MOV BL, 57H MOV
BH, 04H MOV AL,
BL MOV CL, BH
SHL AL, CL ROR
AL, CL MOV DL,
AL MOV AL, BL
MOV CL, BH SHR
AL, CL MOV DH,
AL XOR DX, 3030h
INT 21H
END

INPUT: BCD number: 57

OUTPUT: ASCII Number (DX) = 3537

RESULT: Thus the program for converting from BCD to ASCII has been executed successfully by
using TRAINER KIT and result is verified.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 29


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 13

Move a block one segment to another segment

AIM: To write an ALP (8086) to move the block of data from one segment to another segment.

APPARATUS: 8086 Tainer kit,keyboard.

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of source segment.
4. Initialize ES register with the starting address of destination segment.
5. Copy the number of bytes in the string to CL register.
6. Store the offset address in source and destination segments in SI and DI registers respectively.
7. Select the auto increment/decrement of offset address using direction flag.
8. Move the string bytes from source segment to destination segment until all the bytes are moved.
9. Terminate the program.
10. Stop

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 30


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

PROGRAM:
. MODEL SMALL
. STACK
. DATA
STRING DB ’COMPUTER’
STRING1 DB 8 DUP (?)
. CODE
MOV AX, @DATA
MOV DS, AX
MOV ES, AX
MOV CL, 08H
MOV SI, OFFSET STRING MOV
DI, OFFSET STRING1
CLD
REP MOVSB INT
21H
END

INPUT: COMPUTER

OUTPUT: 43h, 4Fh, 4Dh, 50h, 55h, 54h, 45h,52h

RESULT: Thus the program to move a block of string from one memory location to another
memory location is executed successfully.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 31


MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem

EXPERIMENT NO : 14

Reverse String

AIM: To write an ALP (8086) to reverse the string using TRAINER software.

APPARATUS: 8086 Tainer kit,keyboard..

ALGORITHM:
1. Start
2. Define the data segment with required variables.
3. Initialize DS register with the starting address of source segment.
4. Initialize ES register with the starting address of destination segment.
5. Copy the number of bytes in the string to CL register.
6. Copy the offset address of STG into SI register and offset address of ATG1 into DI register.
7. Clear direction flag for copying from lowest address to highest address.
8. Copy the string characters in reverse order from source segment to destination segment.
9. Repeat step8 until the count becomes zero in CL register.
10. Terminate the program
11. Stop

PROGRAM:
RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 32
MICROPROCESSOR LAB MANUAL
B.Tech CSE 5th Sem
.MODEL SMALL
.STACK
.DATA
STG DB ‘SVCET’,’$’ STG1
DB 05H DUP (?), ‘$, COUNT
EQU 05H
.CODE
MOV AX, @DATA
MOV DS, AX
MOV ES, AX MOV CL,
COUNT MOV SI, OFFSET
STG
MOV DI, OFFSET STG1
CLD
ADD SI, 04h A1:
MOVSB DEC SI
DEC SI DEC
CL JNZ A1
MOV AH, 09H LEA
DX, STG1
INT 21H INT
03H END

INPUT: SVCET

OUTPUT: TECVS

RESULT: Thus the ALP for performing the reverse string operation has been successfully
executed.

RSR RCET, BHILAI Assistant Prof. Nanda R Mude Page 33

You might also like