yogesh 8085n

Embed Size (px)

Citation preview

  • 8/2/2019 yogesh 8085n

    1/17

    MicroprocessorLab 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, NOIDAAMITY UNIVERSITY, UTTAR PRADESH

  • 8/2/2019 yogesh 8085n

    2/17

    Experiment No: 1

    Aim:Write a program to Add two 16 bit numbers.

    Apparatus used: 8085 microprocessor kit and keyboard.

    Program:

    Address Opcode Label Opcode Comments

    2000H2001H2002H2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH200EH

    200FH2010H

    2AH00H40HEBH2AH02H40H7BH85H6FH7AH8CH67H22H04H

    40H76H

    LHLD 4000H

    XCHGLHLD 4002H

    MOV A, EADD LMOV L, AMOV A, D

    ADC HMOV H, ASHLD 4004H

    HLT

    Get first 16 bit number in HL

    Save first 16 bit number in DEGet second 16 bit number in HL

    Get lower byte of the first numberAdd lower byte of the second numberStore result in L RegisterGet higher byte of first number

    Add higher byte of second number with carryStore result in H registerStore result in memory location 4000H & 4005H

    Terminate program execution

    Data given:

    4000H : 15 H First number lower byte4001H : 1CH First number higher byte4002H : B7 H Second number lower byte4003H : 5A H Second number higher byte4004H :CC H Result lower byte4005H 76 H Result higher byte

    Result: 1C15H + 5AB7H = 76CCH

  • 8/2/2019 yogesh 8085n

    3/17

    Flow Chart

  • 8/2/2019 yogesh 8085n

    4/17

    Experiment No: 2

    Aim: To Subtract two 16 bit numbers

    Address Opcode Label Opcode Comments

    2000H2001H2002H

    2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH

    200EH200FH2010H

    4000H4001H4002H4003H4004H4005H

    2AH00H40H

    EBH2AH02H40H7BH95H6FH7AH9CH67H22H

    04H40H76H

    19H6AH15H5CH04H0EH

    LHLD 4000H

    XCHGLHLD 4002H

    MOV A, ESUB LMOV L, AMOV A, DSBB HMOV H, ASHLD 4004H

    HLT

    Get first 16 bit number in HL

    Save first 16 bit number in DEGet second 16 bit number in HL

    Get lower byte of the first numberSubtract lower byte of the second numberStore result in L RegisterGet higher byte of first numberSubtract higher byte of second num with borrowStore result in H registerStore result in memory location 4000H & 4005H

    Terminate program execution

    First number lower byteFirst number higher byteSecond number lower byteSecond number higher byteResult lower byteResult higher byte

    Result: 6A19H - 5C15H = OE04H

  • 8/2/2019 yogesh 8085n

    5/17

    Flow Chart

  • 8/2/2019 yogesh 8085n

    6/17

    Experiment No: 3

    Aim: To Multiply two 8 bit numbers

    Address Opcode Label Opcode Comments

    2000H2001H2002H

    2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH

    200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H

    3AH00H40H

    5FH16H00H3AH01H40H4FH21H00H00H19H

    0DHC2H0DH20H22H02H40H76H

    03HB2H16H02H

    BACK

    LDA 4000H

    MOV E, AMVI D, 00H

    LDA 4001H

    MOV C, ALXI H, 0000H

    DAD D

    DCR CJNZ BACK

    SHLD 4002H

    HLT

    First numberSecond numberResult lower byteResult higher byte

    Result: 03H * B2H = 0216H

  • 8/2/2019 yogesh 8085n

    7/17

    Flow Chart

  • 8/2/2019 yogesh 8085n

    8/17

    Experiment No: 4

    Aim: To Divide 16 bits number by 8 bit number

    Address Opcode Label Opcode Comments

    2000H2001H2002H

    2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH

    200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H

    Result:

  • 8/2/2019 yogesh 8085n

    9/17

    Experiment No: 5

    Aim: To find the 1s complement of a 8 bit number

    Address Opcode Label Opcode Comments

    2000H2001H

    2002H2003H2004H2005H2006H2007H

    4000H4001H

    3AH00H

    40H2FH32H01H40H76H

    55HAAH

    LDA 4000H

    CMASTA 4001H

    HLT

    Get the number

    Complement NumberStore the result

    Terminate program execution

    Number to be complemented1s Complemented number result

    Result: 55H AAH

    Flow Chart

  • 8/2/2019 yogesh 8085n

    10/17

    Experiment No: 6

    Aim: To find the 2s complement of a number

    Address Opcode Label Opcode Comments

    2000H2001H2002H2003H2004H2005H2006H2007H2008H2009H

    4000H4001H

    3AH00H40H2FHC6H01H32H01H40H76H

    55HAAH

    LDA 4000H

    CMAADI, 01H

    STA 4001H

    HLT

    Get the number

    Complement Number

    Store the result

    Terminate program execution

    Number to be complemented2s Complemented number result

    Result: 55H AAH

    Flow Chart

  • 8/2/2019 yogesh 8085n

    11/17

    Experiment No: 7

    Aim: To find the largest number in an array of numbers

    Address Opcode Label Opcode Comments

  • 8/2/2019 yogesh 8085n

    12/17

    2000H2001H2002H2003H2004H

    2005H2006H2007H2008H2009H200AH200BH200CH200DH200EH200FH

    2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H4004H4005H

    3A00404F

    AF

    210140BED20D207E230DC2

    022032054076

    04H34H

    A9H78H56H

    A9H

    BACK

    SKIP

    LDA 4000H

    MOV C, AXRA A

    LXI H, 4401H

    CMP MJNC SKIP

    MOV A, MINX HDCR CJNZ BACK

    STA 4005H

    HLT

    Initialize counterMaximum = Minimum possible value = 0

    Initialize pointer

    Is Number > maximumYes, replace maximum

    Store maximum number

    Terminate program execution

    Array lengthFirst numberSecond NumberThird numberFourth NumberResult: Largest Number

    Result: Largest number A9H

    Flow Chart

  • 8/2/2019 yogesh 8085n

    13/17

    Experiment No: 8

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

  • 8/2/2019 yogesh 8085n

    14/17

    Address Opcode Label Opcode Comments

    2000H2001H

    2002H2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H4004H4005H

    Result:

    Experiment No: 9

  • 8/2/2019 yogesh 8085n

    15/17

    Aim: To sort the given numbers in Ascending Order

    Address Opcode Label Opcode Comments

    2000H2001H2002H2003H2004H2005H2006H2007H2008H2009H200AH

    200BH200CH200DH200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H4004H4005H

    Result:

    Experiment No: 10

  • 8/2/2019 yogesh 8085n

    16/17

    Aim: To sort the given numbers in Descending Order

    Address Opcode Label Opcode Comments

    2000H2001H2002H2003H2004H2005H2006H2007H2008H2009H200AH

    200BH200CH200DH200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H4004H4005H

    Result:

    Experiment No: 11

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

  • 8/2/2019 yogesh 8085n

    17/17

    Address Opcode Label Opcode Comments

    2000H2001H

    2002H2003H2004H2005H2006H2007H2008H2009H200AH200BH200CH200DH200EH200FH2010H2011H2012H2013H2014H2015H

    4000H4001H4002H4003H4004H4005H

    Result: