8085 Microprocessor Assembly language program to Check whether the an input number is Prime or not


Aim

To write a 8085 Microprocessor Assembly language program to Check whether the an input? number is Prime or not

Program

AddressMnemonicsOpcodeLSBMSBComments / Explanation
2000LDA 30003A0030Load accumulator
2003MOV C,A4F  Copy value of Reg. From Accumulator
2004CPI 02HFE02 Compare Accumulator with 02
2006JZ 2025CA2520If equal z=0 then jump to 2025
2009CPI 01HFE01 Compare accumulator with 01
200BJZ 202DCA2D20Jump to 202D
200ECPI 01HFE01 Compare accumulator with 01
2010JZ 202DCA2D20If equal jump to 202D
2013MVI B,02H0602 B = 2
2015SUB B90  Subtract b from Accumulator
2016JZ 202DCA2D20Jump to 202D
2019JNC 2015D21520If a=0 then jump to 2015
201CINR B04  Increment B
201DMOV A,C79  Copy C to A
201ECMP BB8  Compare B with Accumulator
201FJZ 2025CA2520If zero jump to 2025
2022JNZ 2015CA1520If not zero jump to 2015
2025MVI A,013E01 Accumulator = 01
2027STA 27F632F627Store value to 27F6
202AJMP 2032C33220Jump to 2032
202DMVI A,0E3E0E Set accumulator with 0E
202FSTA 27F632F627Store value to 27F6
2032CALL 06FACDFA06Call subroutine
2035HLT76  Stop
Output / Observation
input? 3000 0b output 01 i/p 3000 6 o/p 0E
Result
Program to check whether inputed number is prime or not is executed successfully and output is verified

No comments:

Post a Comment

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