0% found this document useful (0 votes)
29 views21 pages

MICROPROCESSOR LAB File

The document contains details of 8 experiments on basic operations like addition, subtraction, multiplication and division of 8-bit and 16-bit numbers. The experiments include the aim, block diagram, program logic and outputs of the operations performed.

Uploaded by

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

MICROPROCESSOR LAB File

The document contains details of 8 experiments on basic operations like addition, subtraction, multiplication and division of 8-bit and 16-bit numbers. The experiments include the aim, block diagram, program logic and outputs of the operations performed.

Uploaded by

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

INDEX

S.NO EXPERIMENT DATE


1. To add two 8 bit numbers 8/1/24
2. To add two 16 bit numbers 15/1/24
3. To add two 8 bit no. with carry 22/1/24
4. Two subtract two 8 bit no. with 29/1/24
carry

5. To multiply two 8 bit numbers 12/2/24


6. To add five consecutive no. 26/2/24
7-a. To move n elements from one 4/3/24
location to another

7-b. To find largest number from 11/3/24


given n numbers

8-a. To perform division of two 8 bit 18/3/24


no. by repetitive subtraction

8-b. To arrange given n numbers in 8/4/24


ascending order
EXPERIMENT-1
AIM: To add two 8 bit numbers
ADRESS COMENT OP CODE
2000 MVI A 3E
2001 23H 23
2002 MVI B 06
2003 32H 32
2004 ADD B 80
2005 STA 32
2006 00 00
2007 30 30
2008 HLT 76

OUTPUT: 23+32=55
EXPERIMENT-2
AIM: To add two 16 bit numbers

Start

Input Accumulator

Input Register B

Add B to A

Carry gets saved


Store A to first address

Input Accumulator

Input Register B

Add B to A with carry

Store A to second address

End
ADRESS COMMENT OP CODE
2000 MVI A 3E
2001 00H 00
2002 MVI B 06
2003 01H 01
2004 ADD B 80
2005 STA 32
2006 00 00
2007 30 30
2008 MVI A 3E
2009 20H 20
200A MVI B 06
200B 30H 30
200C ADC B 88
200D STA 32
200E 01 01
200F 30 30
2010 HLT 76

OUTPUT: 2000+3001=5001
EXPERIMENT-3
AIM: To subtract two 8 bit numbers without borrow

Start

Input Accumulator

Input Register B

Subtract B from A

Store A to the address

End
ADRESS COMENT OP CODE
2000 MVI A 3E
2001 19H 19
2002 MVI B 06
2003 04H 04
2004 SUB B 90
2005 STA 32
2006 00 00
2007 30 30
2008 HLT 76

OUTPUT: 19-4=15
EXPERIMENT-4
AIM: To subtract two 8 bit numbers with borrow

Start

Input Accumulator

Input Register B

Set Register C to zero

Subtract B from A

Check Carry
No

Yes
Complement value in A

Increment A by 1

Store A to first address

Store C to second address

End
ADRESS COMMENT OP CODE
2000 MVI A 3E
2001 23H 23
2002 MVI B 06
2003 18H 18
2004 MVI C 0E
2005 00H 00
2006 SUB B 90
2007 JNC LOOP D2
2008 20 20
2009 0B 0B
200A CMA 2F
200B INRA 3C
200C STA 32
200D 00 00
200E 30 30
200F MOV A,C 79
2010 STA 32
2011 01 01
2012 30 30
2013 HLT 76

OUTPUT: 23-18=5
EXPERIMENT-5
AIM: to multiply two 8 bit numbers

Start

Load A, D with zero

Load B, C with numbers

Add B to A

Check Carry
No

Yes
Increment D by 1

Decrement C by 1

No
Is C == 0 ?

Yes
Store A to first address

Store D to second address

End
ADRESS COMMENT OP CODE
2000 MVI A 3E
2001 00H 00
2002 MVI B 06
2003 4H 4
2004 MVI C 0E
2005 5H 5
2006 MVI D 16
2007 00H 00
2008 ADD B 80
2009 JNC D2
200A 0D 0D
200B 20 20
200C INR D 14
200D DCR C 0D
200E JNZ C2
200F 08H 08
2010 20H 20
2011 STA 32
2012 00H 00
2013 30H 30
2014 MOV A,D 7A
2015 STA 32
2016 01H 01
2017 30H 30
2018 HLT 76
OUTPUT: 4*5=20
EXPERIMENT-6
AIM: To add n ( n= 5) consecutive numbers

Start

Load A, C with zero

Load B with value of n

Add B to A

Check Carry
No

Yes
Increment C by 1

Decrement B by 1

No
Is B == 0 ?

Yes
Store A to first address

Store C to second address

End
ADRESS COMMENT OP CODE
2000 MVI A 3E OUTPUT:
2001 00H 00
2002 MVI B 06
2003 05H 05
2004 MVI C 0E
2005 00H 00
2006 ADD B 80
2007 JNC D2
2008 0B 0B
2009 20 20
200A INR C 0C
200B DCR B 05
200C JNZ C2
200D 06 06
200E 20 20
200F STA 32
2010 00 00
2011 30 30
2012 MOV A,C 79
2013 STA 32
2014 01 01
2015 30 30
2016 HLT 76
1+2+3+4+5=15
EXPERIMENT-7a
AIM: To move n elements from one location to another

Start

Load C with value of n

Load H-L pair with source address

Load D-E pair with target address

Move value at H-L (M) to A

Store value in A at D-E pair

Increment pairs H-L and D-E

Decrement C by 1

No Is B == 0 ?

Yes
End

ADRESS COMENT OP CODE


2000 MVI C 0E
2001 05H 05

2002 LXI H 21
2003 00H 00
2004 25H 25

2005 LXI D 11
2006 00 00

2007 26H 26

2008 MOV A,M 7E

2009 STAX D 12

200A INX H 23

200B INX D 13

200C DCR C 0D

200D JNZ C2

200E 08H 08

200F 20H 20

2010 HLT 76
EXPERIMENT-7b
AIM: To find largest number from given n numbers

Start

Load H-L pair with starting address

Move value of H-L pair to C

Increment H-L pair address

Move value of H-L pair to A

Increment H-L pair address

No
Is value at H-L > A ?

Yes
Move value at H-L to A

Decrement C by 1

Is C == 0 ?
No

Yes

End
ADRESS COMMENT OP CODE
2000 LXI H 21
2001 50H 50
2002 20H 20
2003 MOV C,M 4E
2004 DCR C 0D
2005 INX H 23
2006 MOV A,M 7E
2007 INX H 23
2008 CMP M BD
2009 JNC D2
200A 0DH 0D
200B 20H 20
200C MOV A,M 7E
200D DCR C 0D
200E JNZ C2
200F 07H 07
2010 20H 20
2011 STA 32
2012 50H 50
2013 30H 30
2014 HLT 76
EXPERIMENT-8a
AIM: To perform division of two 8 bit numbers by subtraction

Start

Load H-L pair with start address

Move value at H-L pair to B

Increment H-L pair address

Move value at H-L pair to A

Is value of B > A ?
Yes

No
Subtract B from A

Increment C by 1

Store A to first address

Store D to second address

End
ADRESS COMMENT OP CODE
2000 LXI H 21
2001 50H 50
2002 20H 20
2003 MOV B ,M 46
2004 MVI C 0E
2005 00H 00
2006 INX H 23
2007 MOV A,M 7E
2008 CMP B B8
2009 JC DA
200A 11H 11
200B 20H 20
200C SUB B 90
200D INR C 0C
200E JMP C3
200F 08H 08
2010 20H 20
2011 STA 32
2012 50H 50
2013 30H 30
2014 MOV A,C 79
2015 STA 32
2016 51H 51
2017 30H 30
2018 HLT 76
EXPERIMENT-8b
AIM: To arrange given n numbers in ascending order
ADRESS COMMENT OP CODE
2000 LXI H 21
2001 MVI D 16
2002 00H 00
2003 MOV C,M 4E
2004 DCR C 0D
2005 INX H 23
2006 MOV A,M 7E
2007 INX H 23
2008 CMP M BD
2009 JC DA
200A 16 11
200B 20 20
200C JZ CA
200D 16 0C
200E 20 C3
200F MOV B,M 46
2010 MOV M,A 77
2011 DCX H 2B
2012 MOV M,B 70
2013 INX H 23
2014 MVI D 16
2015 01H 01
2016 DCR C 0D
2017 JNZ C2
2018 MOV A,D 7A
2019 CPI FE
201A 01H 01
201B JZ START CA
201C HLT 76

You might also like