Microprocessor Lab: Submitted By:-Varun Kant SID:-16104088 Submitted To:-Prof Amita
Microprocessor Lab: Submitted By:-Varun Kant SID:-16104088 Submitted To:-Prof Amita
SID:- 16104088
OUTPUT:
Input output
Register Data Register Data
AX 4343 AX 5454
BX 1111
EXPERIMENT NO – 2
OUTPUT:
Input output
Register Data Register Data
AX 4343 AX 3232
BX 1111
EXPERIMENT NO -3
OUTPUT:
Input Output
Register Data Register Data
AX 4343 AX EA73
BX 1111 DX 047B
EXPERIMENT NO -4
AIM: WAP to get 2's complement of 5 hexadecimal nos’ in 8086 microprocessor.
OUTPUT:
INPUT: RESULT:
0700: 05 0400: FA
0701: 01 0401: FE
0702: 0D 0402: F3
0703: 2F 0403: D0
0704: 09 0404: F6
0705: 06 0405: F9
EXPERIMENT NO – 5
AIM : WAP to find greatest number from 10 hexadecimal numbers in 8086
microprocessor.
OUTPUT:
INPUT Results:
0800: 09 0810:FF
0801: FF
0802: 04
0803: 05
0804: 07
0805: 08
0806: F9
0807: 00
0808: 01
0809:06
EXPERIMENT NO- 6
AIM: WAP to find smallest number from 10 hexadecimal numbers in 8086
microprocessor.
LABEL CODE COMMENTS
CLC Clear Carry Flag
MOV SI,0500 The offset address 0500 moved to SI
MOV CX,000A The counter is initiated to 10
MOV AH,FF The value FF is moved to AH
X xx XX CMP [SI],AH Comparing the value in SI with
AH(FF)
JAE YY Jump to 040E if [SI] is greater than or equal to AH
HLT HALT
OUTPUT:
Example: Result
0500: FF 0500: 02
0501: FE
0502: 09
0503: 06
0504: 07
0505: 03
0506: F7
0507: FF
0508: 02
0509: AB
EXPERIMENT NO -7
AIM: Write a program to sort string number of bytes in ascending order
OUTPUT:
Example: Results:
OUTPUT:
Example: Results:
CODE COMMENTS
MOV DI,7000 The final result will be displayed
MOV CX,02
MOV AL,B3 Content moved to AL
HLT Halt
OUTPUT:
INPUT Result:
B3 EA
EXPERIMENT NO – 10
AIM: Write a Program to find the factorial of a number.
OUTPUT:
INPUT: Result:
3000: 07H 3002: 13B0H
3000: 08H 3002: 9D80H
EXPERIMENT NO – 11
AIM: Write a Program to separate odd and even number from a string
OUTPUT:
OUTPUT:
INPUT Results:
2001: 05H
2002: 45H
2003: DFH
2004: EAH
EXPERIMENT NO – 13
AIM: WAP to store any number of string in reverse order.
LABEL CODE COMMENTS
MOV AX,0005H Initialise register AX with the number of bytes of the
string
MOV SI,0500 Copy the starting offset address of the string to the
register SI
DEC AX Decrement the contents of register AX by 1
ADD AX,SI Add the contents of AX and SI to obtain the ending
address of the string.The result is stored in the register
AX.
MOV DI,AX The ending address of the string is moved to the register
DI.
MOV CX, 0002H Copy the number of times the loop is to be run to the
counter register CX.(Let n be the nnumber of bytes string
is containing, if n is odd a numberf (n-1)/2 is moved to CX
and if n is even n/2 is moved to CX).
XX MOV BL,[SI] Copy the element stored at the memory location pointed
by SI to the register BL
XCHG BL,[DI] Exchange the elements of register BL and the element
stored at the memory location pointed by DI.
MOV [SI],BX Copy the contents of BL to the memory location pointed
by SI
INC SI Increment the contents of SI by 1 to point next memory
location
DEC DI Decrement the contents of DI by 1 to point the previous
memory location.
LOOP XX The process of exchanging the elements stored at
memory locations pointed by DI and SI has to be
continued till content of CX becomes 0. Hence LOOP is
used.
HLT Halt
INPUT: OUTPUT:
0500: 1 0500: 5
0501: 2 0501:4
0502:3 0502:3
0503:4 0503:2
0504: 5 0504:1
EXPERIMENT NO – 14
CODE COMMENTS
MOV AX,000A Copying 000Ato AX
MOV BX,AX Copying AX to BX
SHR BX,AX Shift logical right BX by 1
XOR BX,AX XOR BX with AX and result store at BX
MOV[2000],BX Duplicate BX to [2000]
HLT Halt
OUTPUT : 0F
EXPERIMENT NO – 15
AIM: To interface and control a stepper motor using 8086 microprocessor.