Anda di halaman 1dari 17

Microprocessor

Lab File (8085)

Faculty Guide

Submitted by:

Mr. Lala Bhasker

Yogesh Chand Singhal M.Tech -Weekend (2010-2013) ECE - IVth Semester A2326110023

AMITY SCHOOL OF ENGINEERING & TECHNOLOGY, NOIDA AMITY UNIVERSITY, UTTAR PRADESH

Experiment No: 1
Aim: Write a program to Add two 16 bit numbers.
Apparatus used: 8085 microprocessor kit and keyboard. Program:

Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2AH 00H 40H EBH 2AH 02H 40H 7BH 85H 6FH 7AH 8CH 67H 22H 04H 40H 76H

Label

Opcode
LHLD 4000H XCHG LHLD 4002H MOV A, E ADD L MOV L, A MOV A, D ADC H MOV H, A SHLD 4004H HLT

Comments
Get first 16 bit number in HL Save first 16 bit number in DE Get second 16 bit number in HL Get lower byte of the first number Add lower byte of the second number Store result in L Register Get higher byte of first number Add higher byte of second number with carry Store result in H register Store result in memory location 4000H & 4005H Terminate program execution

Data given:
4000H 4001H 4002H 4003H 4004H 4005H

: 15 H : 1CH : B7 H : 5A H :CC H 76 H

First number lower byte First number higher byte Second number lower byte Second number higher byte Result lower byte Result higher byte

Result: 1C15H + 5AB7H = 76CCH

Flow Chart

Experiment No: 2
Aim: To Subtract two 16 bit numbers
Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 4000H 4001H 4002H 4003H 4004H 4005H 2AH 00H 40H EBH 2AH 02H 40H 7BH 95H 6FH 7AH 9CH 67H 22H 04H 40H 76H 19H 6AH 15H 5CH 04H 0EH

Label

Opcode
LHLD 4000H XCHG LHLD 4002H MOV A, E SUB L MOV L, A MOV A, D SBB H MOV H, A SHLD 4004H HLT

Comments
Get first 16 bit number in HL Save first 16 bit number in DE Get second 16 bit number in HL Get lower byte of the first number Subtract lower byte of the second number Store result in L Register Get higher byte of first number Subtract higher byte of second num with borrow Store result in H register Store result in memory location 4000H & 4005H Terminate program execution First number lower byte First number higher byte Second number lower byte Second number higher byte Result lower byte Result higher byte

Result: 6A19H - 5C15H = OE04H

Flow Chart

Experiment No: 3
Aim: To Multiply two 8 bit numbers
Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 3AH 00H 40H 5FH 16H 00H 3AH 01H 40H 4FH 21H 00H 00H 19H 0DH C2H 0DH 20H 22H 02H 40H 76H 03H B2H 16H 02H

Label

Opcode
LDA 4000H MOV E, A MVI D, 00H LDA 4001H MOV C, A LXI H, 0000H

Comments

BACK

DAD D DCR C JNZ BACK SHLD 4002H HLT First number Second number Result lower byte Result higher byte

Result: 03H * B2H = 0216H

Flow Chart

Experiment No: 4
Aim: To Divide 16 bits number by 8 bit number
Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H

Label

Opcode

Comments

Result:

Experiment No: 5
Aim: To find the 1s complement of a 8 bit number
Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 4000H 4001H 3AH 00H 40H 2FH 32H 01H 40H 76H 55H AAH

Label

Opcode
LDA 4000H CMA STA 4001H HLT

Comments
Get the number Complement Number Store the result Terminate program execution Number to be complemented 1s Complemented number result

Result: 55H

AAH

Flow Chart

Experiment No: 6
Aim: To find the 2s complement of a number
Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 4000H 4001H 3AH 00H 40H 2FH C6H 01H 32H 01H 40H 76H 55H AAH

Label

Opcode
LDA 4000H CMA ADI, 01H STA 4001H HLT

Comments
Get the number Complement Number Store the result Terminate program execution Number to be complemented 2s Complemented number result

Result: 55H

AAH

Flow Chart

Experiment No: 7
Aim: To find the largest number in an array of numbers
Address Opcode Label Opcode Comments

2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 4004H 4005H

3A 00 40 4F AF 21 01 40 BE D2 0D 20 7E 23 0D C2 02 20 32 05 40 76 04H 34H A9H 78H 56H A9H

LDA 4000H MOV C, A XRA A LXI H, 4401H BACK CMP M JNC SKIP MOV A, M INX H DCR C JNZ BACK STA 4005H HLT Store maximum number Terminate program execution Array length First number Second Number Third number Fourth Number Result: Largest Number Initialize counter Maximum = Minimum possible value = 0 Initialize pointer Is Number > maximum Yes, replace maximum

SKIP

Result: Largest number

A9H

Flow Chart

Experiment No: 8
Aim: To find the smallest number in an array of numbers

Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 4004H 4005H

Label

Opcode

Comments

Result:

Experiment No: 9

Aim: To sort the given numbers in Ascending Order


Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 4004H 4005H

Label

Opcode

Comments

Result:

Experiment No: 10

Aim: To sort the given numbers in Descending Order


Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 4004H 4005H

Label

Opcode

Comments

Result:

Experiment No: 11
Aim: To find square root of a 8 bit binary number

Address Opcode
2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 4000H 4001H 4002H 4003H 4004H 4005H

Label

Opcode

Comments

Result:

Anda mungkin juga menyukai