You are on page 1of 2

Program to find the factorial of a number

MVI B, 03
H

MOV C, B
DCR C
LOOP1: MOV E, C
SUB A
LOOP2: ADD B
DCR E
JNZ LOOP2
MOV B, A
DCR C
JNZ LOOP1
STA 8000
H

HLT
8085 Microprocessor Assembly language Program To Find Square Of the Given Number
Aim
To write an ALP (8085 Microprocessor Assembly language Program ) To Find Square Of the Given
Number

Program
Address Mnemonics Opcode LSB MSB Comments
2000 LDA 2500H 3A 00 25 Load accumulator
2003 MOV B,A 47 Copy A to Register B
2004 MOV C,A 4F Copy A to Register C
2005 MVI A,00 3E 00 Clear A
2007 MVI D,00 16 00 Clear D
2009 ADD C 81 Add A+D
200A JNC 200E D2 0E 20 Jump on no carry
200E DCR B 05 Decrement B
200F JNZ 2009 C2 09 20 Jump on non zero
2012 STA 27F4 32 F4 27 Store result in 27F4
2015 MOV A,D 7A Move D to A
2016 STA 27F5 32 F5 27 Store result in 27F5
2019 CALL 06E3 CD E3 06 Call subroutine
201C HLT 76 Stop



Observation / Output
i/p
2500 FF
o/p
FE 01

You might also like