Aim
To write a 8085 Microprocessor Assembly language program to Check whether the an input? number is Prime or not
Program
Address Mnemonics Opcode LSB MSB Comments / Explanation 2000 LDA 3000 3A 00 30 Load accumulator 2003 MOV C,A 4F Copy value of Reg. From Accumulator 2004 CPI 02H FE 02 Compare Accumulator with 02 2006 JZ 2025 CA 25 20 If equal z=0 then jump to 2025 2009 CPI 01H FE 01 Compare accumulator with 01 200B JZ 202D CA 2D 20 Jump to 202D 200E CPI 01H FE 01 Compare accumulator with 01 2010 JZ 202D CA 2D 20 If equal jump to 202D 2013 MVI B,02H 06 02 B = 2 2015 SUB B 90 Subtract b from Accumulator 2016 JZ 202D CA 2D 20 Jump to 202D 2019 JNC 2015 D2 15 20 If a=0 then jump to 2015 201C INR B 04 Increment B 201D MOV A,C 79 Copy C to A 201E CMP B B8 Compare B with Accumulator 201F JZ 2025 CA 25 20 If zero jump to 2025 2022 JNZ 2015 CA 15 20 If not zero jump to 2015 2025 MVI A,01 3E 01 Accumulator = 01 2027 STA 27F6 32 F6 27 Store value to 27F6 202A JMP 2032 C3 32 20 Jump to 2032 202D MVI A,0E 3E 0E Set accumulator with 0E 202F STA 27F6 32 F6 27 Store value to 27F6 2032 CALL 06FA CD FA 06 Call subroutine 2035 HLT 76 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 ..........