0% found this document useful (0 votes)
147 views

MP Lab Manual (2019-20) PDF

This document is a lab manual for microprocessors used in the B. Tech CSE program at RVS Nagar campus. It contains 6 experiments with the objectives, software used, programs written, and results for each experiment. The experiments cover topics like data transfer between memory locations, arithmetic operations on numbers, and analyzing data in lists. Students are required to complete the experiments and get their work signed by the instructor for evaluation.

Uploaded by

Nanishiva
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)
147 views

MP Lab Manual (2019-20) PDF

This document is a lab manual for microprocessors used in the B. Tech CSE program at RVS Nagar campus. It contains 6 experiments with the objectives, software used, programs written, and results for each experiment. The experiments cover topics like data transfer between memory locations, arithmetic operations on numbers, and analyzing data in lists. Students are required to complete the experiments and get their work signed by the instructor for evaluation.

Uploaded by

Nanishiva
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/ 35

MICROPROCESSORS

LAB MANUAL
for

B. Tech CSE (Batch: 2018)

II Year / III Semester

Course Code: 18CS2111R

Campus: RVS NAGAR, Aziz Nagar (PO), Moinabad Road,


Hyderabad, R.R. Dist – 500 075, Telangana, INDIA

Name :

Reg. No. :

Class & Sec :


Date: _____________

1. a) Data transfer in forward direction

Aim:
To write an ALP program to transfer the array of data located in 2000 H memory
location [SI] to 3000 H memory location [DI].

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE DATA SEGMENT
BLK1 DB
01,02,03,04,05,06,07,08,09,0AH BLK2
DB 10 DUP (?)
COUNT DW
0AH DATA
ENDS CODE
SEGMENT
START: MOV AX, DATA ; MOV THE STARTING
ADDRESS MOV DS, AX
MOV SI, OFFSET BLK1 ; SET POINTER REG TO
BLK1 MOV DI, OFFSET BLK2 ; SET POINTER REG
TO BLK2 MOV CX, 0AH ; SET COUNTER
AGAIN: MOV AL, [SI]
MOV [DI], AL
INC SI
INC DI
DEC CL ; DECREMENT
COUNTER JNZ AGAIN ; TO END
PROGRAM
MOV AH,4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to transfer the array of data located in 2000 H memory location [SI] to
3000 H memory location [DI] has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

1. b) Data transfer in Reverse direction


Aim:
To write an ALP program to transfer the array of data located in 2000 H memory
location [SI] to 3000 H memory location [DI].

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA,CS:CODE
DATA SEGMENT
BLK1 DB
01,02,03,04,05,06,07,08,09,0AH BLK2
DB 10 DUP (?)
COUNT DW
0AH DATA
ENDS CODE
SEGMENT
START: MOV AX, DATA ; MOV THE STARTING
ADDRESS MOV DS, AX
MOV SI, OFFSET BLK1 ; SET POINTER REG TO
BLK1 MOV DI, OFFSET BLK2 ; SET POINTER REG
TO BLK2 MOV CX, 0AH ; SET COUNTER
ADD SI,0009H
AGAIN: MOV AL, [SI]
MOV [DI], AL
DEC
SI INC
DI
DEC CL ; DECREMENT
COUNTER JNZ AGAIN ; TO END
PROGRAM
MOV AH,4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to transfer the array of data located in 2000 H memory location [SI] to
3000 H memory location [DI] has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

2. a) Addition of n-bit Numbers


Aim:
To write an ALP program for addition of n-bit numbers.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA,CS:CODE
DATA SEGMENT
ARRAY DW 2222H,0FCD3H,4444H,5555H,0032CH COUNT DB 05H
SUM DW 00H
CARRY DB 00H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV CL,COUNT
MOV SI,OFFSET ARRAY
MOV AX,00H
GO: ADD AX,[SI]
ADC CARRY,0H
ADD SI,02H
DEC CL
JNZ GO
MOV SUM,AX
MOV AH,4CH
INT 21H

CODE ENDS
END START
Result:
ALP program for addition of n-bit numbers has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

2. b) Multiplication of two 16-bit Numbers


Aim:
To write an ALP program to multiply two 16-bit numbers.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE
DATA SEGMENT
X1 DW 1234H
X2 DW 0002H
RES DW ?
RES1 DW ?
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV DX, 0000H
MOV AX, X1
MOV BX, X2
MUL BX
MOV [RES], AX
MOV [RES1], DX
MOV AH,4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to multiply two 16-bit numbers has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

2. c) Division of two 16-bit Numbers


Aim:
To write an ALP program to divide two 16-bit numbers.

Software Used:
EMU8086 / TASM

Program:
ASSUME
CS:CODE,DS:DATA
DATA SEGMENT
NUM1 DW 0234H
NUM2 DW 03H
QUO DW 00H
REM DW 00H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, NUM2
CBW
MOV NUM2, AX
MOV AX, NUM1
IDIV NUM2
MOV QUO, AX
MOV REM, DX
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to divide two 16-bit numbers has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

3. Finding number of one’s in a 16-bit Number

Aim:
To write an ALP program to find number of 1’s in a 16-bit number.

Software Used:
EMU8086 / TASM

Program:
ASSUME CS:CODE, DS:DATA
DATA SEGMENT
NO DW 5648H
Zero DW ?
One DW ?
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, NO
MOV BX, 00H
MOV CX, 10H
MOV DX, 00H
UP:
ROL AX,1
JC ONE1
INC BX
JMP NXT
ONE1:
INC DX
NXT:
DEC CX
JNZ UP
MOV Zero, BX
MOV One, DX
MOV AH, 4CH
INT 21H
CODE ENDS
END START

Result
ALP program to find number of 1’s in a 16-bit number has been written and has been
verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

4. Finding number of even & odd numbers in a list

Aim:
To write an ALP program to find number of even and odd numbers in a list.

Software Used:
EMU8086 / TASM

Program:
DATA SEGMENT
A DW 1,2,3,4,5,6,7,8,9,10,11
O DB ?
E DB ?
DATA
ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START: MOV AX, DATA
MOV DS, AX
LEA SI, A
MOV DX, 0000
MOV BL, 02
MOV CL, 11
L1:MOV AX, WORD PTR[SI]
DIV BL
CMP AH, 00
JNZ L2
INC DH
JMP L3
L2:INC DL
L3:ADD SI, 2
DEC CL
CMP CL, 00
JNZ L1
MOV E, AL
MOV O, DL
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to find number of even and odd numbers in a list has been written and
has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

5. Counting numbers in a bit having one as sixth


digit

Aim:
To write an ALP program to count numbers in a bit having one as sixth digit.

Software Used:
EMU8086 / TASM

Program:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
SERIES DB 21H,54H,05H,34H,32H,14H,18H,17H,53H,58H
COUNT2 DB 0AH
COUNT DB 00H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
LEA SI, SERIES
MOV CL, COUNT2
NXTP: MOV AX, [SI]
TEST AX, 20H
JZ GO
INC COUNT
GO: INC SI
DEC CL
JNZ NXTP
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to count numbers in a bit having one as sixth digit has been written and
has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

6. a) Finding maximum number in a list

Aim:
To write an ALP program to find maximum number in a list.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA,CS:CODE
DATA SEGMENT
SERIES DW 2222H,9999H,0001H,9994H,0011H
CNTR DW 04H
MAX DW 0H
MIN DW 0H
DATA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
MOV CX, CNTR
LEA SI, SERIES
MOV AX, [SI]
GO:INC SI
INC SI
CMP AX, [SI]
JC MAXVALUE
JMP NXTP
MAXVALUE: MOV BX, [SI]
MOV AX, BX
NXTP:DEC CX
JNZ GO
MOV MAX, BX
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to find maximum number in a list has been written and has been
verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

6. b) Finding minimum number in a list

Aim:
Write an ALP program to find minimum number in a list.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA,CS:CODE
DATA SEGMENT
SERIES DW 2222H,9999H,0001H,9994H,0011H
CNTR DW 04H
MAX DW 0H
MIN DW 0H
DATA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
MOV CX, CNTR
LEA SI, SERIES
MOV AX, [SI]
MOV DX, [SI]
GO:INC SI
INC SI
CMP AX, [SI]
JNC MINVALUE
JMP NXTP
MINVALUE: MOV BX, [SI]
MOV AX, BX
NXTP:DEC CX
JNZ GO
MOV MIN, BX
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to find minimum number in a list has been written and has been
verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

7. a) Arranging numbers (unsigned numbers) in


ascending order

Aim:
To write an ALP program to arrange given numbers in ascending order.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE
DATA SEGMENT
ORG 300H
ARRAY DB 0AH,07H,05H,01H,09H,04H,06H,02H,08H
COUNT EQU 09H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV SI, OFFSET ARRAY
MOV CX, COUNT-1
BEGIN: MOV DX, CX
MOV BX, 1
BACK: MOV AL, [SI]
CMP AL, [SI+BX]
JC SKIP
XCHG AL, [SI+BX]
MOV [SI], AL
SKIP: INC BX
DEC DX
JNZ BACK
INC SI
LOOP BEGIN
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to arrange given numbers in ascending order has been written and has
been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

7. b) Arranging numbers (signed numbers) in


descending order

Aim:
To write an ALP program to arrange given numbers in descending order.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE
DATA SEGMENT
ARRAY DB 03H,07H,05H,01H,09H,04H,06H,02H,08H
COUNT EQU 09H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV SI, OFFSET ARRAY
MOV CX, COUNT-1
BEGIN: MOV DX, CX
MOV BX, 1
BACK: MOV AL, [SI]
CMP AL, [SI+BX]
JNC SKIP
XCHG AL, [SI+BX]
MOV [SI], AL
SKIP: INC BX
DEC DX
JNZ BACK
INC SI
LOOP BEGIN
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to arrange given numbers in descending order has been written and has
been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

8. a) Data in forward direction

Aim:
To write an ALP program to arrange data in forward direction.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE, ES:EXTRA
DATA SEGMENT
STRING1 DB 'MICROPROCESSOR'
COUNT DB $-STRING1
DATA ENDS
EXTRA SEGMENT
STRING2 DB 14D DUP(00H)
EXTRA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
MOV AX, EXTRA
MOV ES, AX
MOV CL, COUNT
LEA SI, STRING1
LEA DI, STRING2
CLD
REP MOVSB
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to arrange data in forward direction has been written and has been
verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

8. b) Data in reverse direction

Aim:
To write an ALP program to arrange data in reverse direction.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE, ES:EXTRA
DATA SEGMENT
STRING1 DB 'MICROPROCESSOR'
LENGTH_STRING DW $-STRING1
DATA ENDS
EXTRA SEGMENT
STRING2 DB 14D DUP(00H)
EXTRA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
MOV AX, EXTRA
MOV ES, AX
MOV CX, LENGTH_STRING
LEA SI, STRING1
LEA DI, STRING2
ADD SI, LENGTH_STRING
DEC SI
GO:MOVSB
SUB SI, 02H
LOOP GO
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to arrange data in reverse direction has been written and has been
verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

9. Finding factorial of a number

Aim:
To write an ALP program to find factorial of a number.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE
DATA SEGMENT
NUM DB 08H
FACT DW 00H
DATA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
XOR CX, CX
XOR AX, AX
INC AX
MOV CL, NUM
CMP CL, 0
JE GO
REPEAT:MUL CX
LOOP REPEAT
GO:MOV FACT, AX
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to find factorial of a number has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

10. Palindrome

Aim:
To write an ALP program to find a whether string is palindrome or not.

Software Used:
EMU8086 / TASM

Program:
DATA SEGMENT
STR1 DB 'RADAR','$'
STRLEN1 DW $-STR1
STRREV DB 20 DUP(' ')
STR_PALIN DB 'STRING IS PALINDROME.','$'
STR_NOT_PALIN DB 'STRING IS NOT PALINDROME.','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
BEGIN: MOV AX, DATA
MOV DS, AX
MOV ES, AX
MOV CX, STRLEN1
ADD CX, -2
LEA SI, STR1
LEA DI, STRREV
ADD SI, STRLEN1
ADD SI, -2
L1: MOV AL, [SI]
MOV [DI], AL
DEC SI
INC DI
LOOP L1
MOV AL, [SI]
MOV [DI], AL
INC DI
MOV DL, '$'
MOV [DI], DL
MOV CX, STRLEN1
PALIN_CHECK:
LEA SI, STR1
LEA DI, STRREV
REPE CMPSB
JNE NOT_PALIN
PALIN: MOV AH, 09H
LEA DX, STR_PALIN
INT 21H
JMP EXIT
NOT_PALIN:
MOV AH, 09H
LEA DX, STR_NOT_PALIN
INT 21H
EXIT: MOV AX, 4C00H
INT 21H

CODE ENDS
END START

Result:
ALP program to find a whether string is palindrome or not has been written and has
been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:


Date: _____________

11. Display the message

Aim:
To write an ALP program to display the message.

Software Used:
EMU8086 / TASM

Program:
ASSUME DS:DATA, CS:CODE
DATA SEGMENT
MSG DB "KLUNIVERSITY",0DH,0AH,"$"
DATA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX
LEA DX, MSG
MOV AH, 09H
INT 21H
MOV AH, 4CH
INT 21H

CODE ENDS
END START
Result:
ALP program to display the message has been written and has been verified.

Pre-Lab In-Lab Post-Lab Total


Session Session Session Marks
Work Work Work (10M)
(2M) (6M) (2M)

Signature of the Instructor:

You might also like