8085 Microprocessor Assembly Language Program To Find Largest And Smallest


Aim
To write a 8085 ALP to find largest and smallest of n 8 bit numbers

Program

AddressMnemonicsOpcodeLSBMSBComments
2000LDA 25003A025Load accumulator with count
2003MOV C,A4FCopy count to register c
2004LXI H,2501210125Load first number's address in HL pair
2007MOV A,M7ECopy first accumulator
2008MOV B,A47Copy first number to register B
2009MOV D,A57Copy first number to register D
200ADCR C0DDecrement limit
200BINX H23Take next number in HL pair
200CMOV A,M7ECopy next number to accumulator
200DCMP BB8Compare the number with accumulator
200EJNC 2012D21220If new number is larger jump to 2012
2011MOV B,A47If number is smaller set it as smaller
2012CMP DBACompare number with register D
2013JC 2017DA1720Jump to 2017 if new number is not larger
2017DCR C0DDecrement count by 1
2018JNZ 200BC20B20Check limit reached or not
201BMOV A,B78Copy smallest number to accumulator
201CSTA 27F432F427Store smallest value
201FMOV A,D7ACopy largest value to accumulator
2020STA 27F532F527Store largest value
2023CALL 06E3CDE36Call subroutine
2026HLT76End

No comments:

Post a Comment

Post Your valuable comments here ..........