MIPRACTICALS
MIPRACTICALS
MIPRACTICALS
PRACTICAL -1
AIM: Write an 8085 assembly language program for exchanging two 8-bit
numbers stored in memory locations 2050h and 2051h.
CODE:
LXI H, 2050H
MOV A,M
INX H
MOV C,M
XRA C
MOV D,A
XRA C
MOV E,A
XRA D
STA 2050H
MOV A,E
STA 2051H
HLT
OUPUT:
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -2
AIM: Write an 8085 assembly language program for exchanging two 8-bit
numbers stored in memory locations 2050h and 2051h.
CODE:
LXI H,2050H
MOV A,M
INX H
MOV C,M
XRA C
MOV D,A
XRA C
MOV E,A
XRA D
STA 2050H
MOV A,E
STA 2051H
HLT
OUTPUT:
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -3
AIM: Write an 8085 assembly language program to add two 16-bit
numbers stored in memory.
CODE:
F000 LXI H,8000H
F003 LXI D,8002H
F006 LDAX D
F007 ADD M
F008 MOV C, A
F009 INX H
F00A INX D
F00B LDAX D
F00C ADC M
F00D MOV B,A
F00E MOV H,B
F00F MOV L,C
F010 SHLD 8050H
F013 JNC
F016 MVI A, 01H
F018 STA 8052H
HLT
OUTPUT;
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -4
AIM: Write an 8085 assembly language program to add two decimal
numbers using DAA instruction.
CODE:
MVI A,0Ah
DAA
MOV B, A
MVI A,0Bh
DAA
ADD B
HLT
OUTPUT:
INPUT
A 0Ah
B 0Bh
OUTPUT
A 21h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -5
AIM: Write an 8085 assembly language program to find the minimum
from two 8-bit numbers.
CODE:
LDA 2050
MOV B, A
LDA 2051
CMP
JC**
MOV A, B
** STA 2052
OUTPUT:
INPUT:
2050:05
2051:02
OUTPUT:
2052:02
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -6
AIM: Write an 8085 assembly language program to get the minimum from
block of N 8-bit numbers.
CODE:
LXI H, 2200H
MOV C, M
INX H
MOV A, M
DCR C
BACK: INX H
CMP M
JC NEXT
MOV A, M
NEXT: DCR C
JNZ BACK
INX H
MOV M,A
RST-5
OUTPUT:
2200H: 04
2201H: 02
2202H: 03
2203H: 04
2204H: 03
2205H: 02
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -7
AIM: Write an 8085 assembly language program to add block of 8-bit
numbers.
CODE:
F000 LXI H, 8000H
F003 MOV C, M
F004 LXI H, 8010H
F007 XRA A
F008 MOV E, A
F009 ADD M
F00A JNC SKIP
F00D INR E
F00E DCR C
F00F INX H
F010 JNZ LOOP
F013 LXIH, 9000H
F016 MOV M, A
F017 INX H
F018 MOV M, E
F019 HLT
OUTPUT:
9000 DC
9001 03
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -8
AIM: Write an 8085 assembly language program to find the number of 1’s
binary representation of given 8-bit number.
CODE:
MVI A,0Ah
STA 2050h
LDA 2050h
MVI B,00h
MVI C,08h
LOOP:
RRC
JZ SKIP
INR B
SKIP:
DCR B
JNZ LOOP
MOV A,B
STA 3050h
HLT
OUTPUT:
INPUT
2050h 0Ah
OUTPUT
3050h 08h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -9
AIM: Write an 8085 assembly language program to count the length of
string ended with 0dh starting from location 2050h.
CODE:
MVI A,0Ah
STA 2050h
MVI A,0Bh
STA 2051h
MVI A,0Ch
STA 2052h
MVI A,0Dh
STA 2053h
MVI A,0Eh
STA 2054h
LXI H,2050h
MVI B,00h
LOOP:
MOV A,M
CPI 0Dh
JZ EXIT
INR B
INX H
JNZ LOOP
EXIT: HLT
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
OUTPUT:
INPUT
2050 0Ah
2051 0Bh
2052 0Ch
2053 0Dh
2054 0Eh
OUTPUT
B 03h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -10
AIM: Write an 8085 assembly language program to covert given hex digit
to its equivalent ASCII number.
CODE:
MVI A,E4h
STA 2050h
LDA 2050h
MOV B,A
ANI F0h
CALL SUB
STA 2054h
MOV A,B
ANI 0Fh
RLC
RLC
RLC
RLC
CALL SUB
STA 2055h
HLT
SUB:
CPI 0Ah
JC SKIP
ADI 37h
RET
SKIP:
ADI 30h
RET
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
OUTPUT:
INPUT
2050 E4h
OUTPUT
2054 34h
2055 45h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -11
AIM: Write an 8085 assembly language program to compute even parity
and insert it as MSB in 8-bit number.
CODE:
MVI A,12h
ORA A
JPE EVEN
ANI 7Fh
HLT
EVEN: ORI 80h
HLT
OUTPUT:
INPUT
A 12h
OUTPUT
A 92h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -12
AIM: Write a subroutine to exchange two 8-bit numbers. Use it to reverse
an array of 8-bit numbers.
CODE:
MVI A,01h
STA 2050h
MVI A,02h
STA 2051h
MVI A,03h
STA 2052h
MVI A,04h
STA 2053h
MVI A,05h
STA 2054h
LXI H,2050h
LXI D,3054h
MVI C,05h
LOOP:
CALL SWAP
INX B
DCX D
DCR C
JNZ LOOP
HLT
SWAP:
MOV B, M
LDAX D
MOV M, A
MOV A, B
STAX D
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
RET
OUTPUT:
INPUT
2050 01h
2051 02h
2052 03h
2053 04h
2054 05h
OUTPUT
3050 05h
3051 04h
3052 03h
3053 02h
3054 01h
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -13
AIM: Design and develop an Assembly language program using 8086
microprocessor and to show the following aspects.
a. Programming
b. Execution
c. Debugging To Demonstrate the Tool Chain for MASM and Hardware for
8086 Microprocessor
CODE:
.MODEL SMALL
.DATA
DUP (?)
COUNT DW 0AH
.CODE
MOV AX,
@DATA MOV
AX
AGAIN: CLD
REP MOVSB
MOV
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
OUTPUT:
BEFORE EXECUTION
AFTER EXECUTION
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
PRACTICAL -14
AIM: a. Write an ALP program to perform 8 Bit arithmetic operations
using MASM software and 8086.
b. Write an ALP program to perform 16 Bit arithmetic operations using
MASM software and
8086.
CODE: A
ADDITION AND SUBTRACTION:
. 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
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
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
END
OUTPUT:
INPUT
19h, 29h, 39h, 49h, 59h, 99h
OUTPUT
01B6H
MULTIPLICATION:
. MODEL SMALL .
STACK .
DATA
.CODE
MOV AX, 1234h
MOV BX, 1234h
MUL BX
INT 21h
END
OUTPUT:
INPUT
1234h
1234h
OUTPUT
DX: AX=014B5A90h
DIVISION:
. MODEL SMALL .
STACK
. DATA .
CODE
MOV AX, -0002h
MOV BL, 80h
IDIV BL
INT 21h
END
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
OUTPUT:
INPUT
AX 0002h
BL 80h
OUTPUT
AL (Q) = 00h
AH(R) = FEh
CODE: B
ADDITION:
Code segment
Start:
MOV AX, 4343
MOV BX, 1111
ADD AX, BX
INT 3
Code ends
End start
OUTPUT:
INPUT
AX 4343
BX 1111
OUTPUT
AX 5454
SUBTRACTION:
Code segment
Start:
MOV AX, 4343
MOV BX, 1111
SUB AX, BX
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
INT 3
Code ends
End start
OUTPUT:
INPUT
AX 4343
BX 1111
OUTPUT
AX 3232
MULTIPLICATION:
Code segment
Start:
MOV AX, 4343
MOV BX, 1111
MUL BX
INT 3
Code ends
End start
OUTPUT:
INPUT
AX 4343 BX 1111
OUTPUT
AX EA73
DX 047B
DIVISION:
Code segment
Start:
MOV AX,4343
MOV BX,1111
DIV BX
VIEAT/B.E./SEM-IV/220943107040
Microprocessor and Interfacing (3160712)
INT 3
Code ends
End start
OUTPUT:
INPUT
AX 4343
BX 1111
OUTPUT
AX EA73
DX 047B
VIEAT/B.E./SEM-IV/220943107040