Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
270 views

Program To Find The Factorial of A Number

The program takes a number as input, squares it, and stores the result. It loads the input number into the accumulator, copies it to registers B and C. It clears registers A and D to 0. It then adds the number in C to D in a loop, decrementing B each time. Once B reaches 0, the final values of A and D contain the squared number, which is stored in memory locations 27F4 and 27F5. It then calls a subroutine and halts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
270 views

Program To Find The Factorial of A Number

The program takes a number as input, squares it, and stores the result. It loads the input number into the accumulator, copies it to registers B and C. It clears registers A and D to 0. It then adds the number in C to D in a loop, decrementing B each time. Once B reaches 0, the final values of A and D contain the squared number, which is stored in memory locations 27F4 and 27F5. It then calls a subroutine and halts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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