Python,C,C++ and JAVA programs for CBSE, ISC, B.Tech and I.T Computer Science and MCA students

The Programming Project: Factorial in 8085 Programming

Wednesday, May 1, 2013

Factorial in 8085 Programming


To find the factorial of n <=6 stored at 0000H. Result stored at memory location 0001H

LDA 0000H
MOV B,A
CPI 00H
JZ LAST1
CPI 01H
JZ LAST1
XRA A
MOV D,B
DCR B
MOV C,B
MOV E,C
LOOP: ADD  D
DCR C
JNZ LOOP
MOV D,A
XRA A
DCR E
MOV C,E
DCR B
JNZ LOOP
MOV A,D
STA 0001H
JMP LAST
LAST1: MVI A,01H
STA 0001H
LAST: HLT

No comments:

Post a Comment