PROGRAM NO.4
OBJECT:Write a program to calculate the Factorial of a Number.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
PROGRAM:
MEMORY LOCATION | MACHINE CODE | OPCODE | OPERAND |
0204 | BE 00 02 | MOV | SI,0200H |
0207 | 8B 04 | MOV | AX,[SI] |
0209 | 8B D8 | MOV | BX,AX |
020B | 4B | DEC | BX |
020C | F7 E3 | L1 : MUL | BX |
020E | 4B | DEC | BX |
020F | 75 FB | JNZ L1 | |
0211 | BF 02 02 | MOV | DI,0202H |
0214 | 89 05 | MOV | [DI],AX |
0216 | F4 | HLT |
DESCRIPTION:
To solve the given objective we have taken a hexadecimal number in the memory location of 0200H and multiplied it successively to obtain the factorial.
To solve the given objective we have taken the following steps:
- Move the source index register (SI) pointer to the location of the number.
- Store the number in the AX register using SI.
- Move the same number in the BX register to act as a counter.
- Decrement BX to get the next number to be multiplied.
- Multiply the number in BX and AX recursively and decrement BX simultaneously to get the factorial eventually.
- Move the destination index (DI) pointer to point to the memory location where the result is to be stored.
- Finally move the result from the AX register to the destination using DI and Halt.
INPUT VALUE:
MEMORY LOCATION | VALUE |
0200H | 05 |
0201H | 00 |
0202H | 00 |
0203H | 00 |
OUTPUT:
MEMORY LOCATION | VALUE |
0202H | 78 |
0203H | 00 |
RESULT:The factorial of the hexadecimal number 0005H comes out to be as 0078H, which gets stored in the memory location 0202H.
COMMENTS:
- MOV SI,0200H: 16 bit data can be moved using immediate addressing. 0200 is moved to source index.
- MUL BX: This instruction is used for the multiplication of 2 unsigned numbers. It multiplies the content of BX with AX and stores in AX.
- DEC BX: This instruction decrements specified 16-bit register by one.
- JNZ: It causes the program execution to jump to the label given in the instruction.
- HLT: This instruction stops program execution. The processor stops fetching and executing instructions.
FLOWCHART:

Most Important Question for Exam
1. Which of the following memory medium is not used as main memory system?
Magnetic tape
2. Register, which are partially visible to users and to hold conditional, are known as
General purpose register
3. One of the main feature that distinguish Microprocessor from Micro-computer is
Microprocessor dos not contain I/O devices
4. The First Microprocessor built by the Intel Corporation was called
4004
5. An integrated circuit is
Fabricated on a tiny silicon chip
6. Most important advantage of an IC is its
Extremely high reliablity
7. Which of the following items are examples of storage devices?
All of the these
8. The width of a processor’s data path is meausred in bits of the following are common data paths?
8 bit
9. Which is the type of memory for information on your Computer?
ROM
10. What type of memory is not directly addressable by the CPU and requires special softwaqre called EMS (Expanded Memory Specification) ?
Expanded
11. Before a disk can be used to store data. It must be…….
Formatted
12. Which company is the biggest player in the Microprocessor industry?
Intel
13. A typical personal computer used for business purpose would have…of ROM.
256 K
14. The word length of a computer is measured in
Bits
15. What are the three decision making operation performed by the ALU a computer?
All of these
16. Which part of the computer is used for calculating and comparing?
ALU
17. Can you tell what pass into and out from the computer via its ports?
Data
18. What is the responsibility of the logical unit in the CPU of a computer?
To compare numbers
19. The secondary storage device can only data but they cannot perform
Either of these
20. Which of the following memories allows simultaneous read and write operations?
RAM
21. Which of the following memories has the shortest access times?
Cache memory
22. A 32 bit Microprocessor has the word length equal to
4 byte
23. An error in computer data is called
Bug
24. The silicon chip used for data processing are called
ROM Chips
25. The metal disk, which are permanentaly housed in sealed and contamination free containers are called
Winchester disk
26. The ALU of a computer normally contains a number of highs speed storage element called
Register
27. The first digital computer built with IC chips was know as
IBM System /360
28. Which of the following terms is the most closely related to main memory?
Temporary
29. Which of the following is used for manufaturer chips?
Semiconductor
30. To locate the data item for storage is
Fetch
Related Link
- 8086 Instruction Hex Code
- Write a program to two add 16 bit Hexadecimal numbers without carry.
- Write a program to two add 16 bit Hexadecimal numbers with carry.
- Write a program to find the greatest number from an array of 10 numbers.
- Write a program to calculate the factorial of a number.
- Write a program to multiply two 16-bit numbers result should be greater than 16 bit.
- Write a program to input 5 numbers and arrange them in descending order.
- Write a program to convert the string data it’s Two’s complement form.
- Write a program to read 8 bit data from Port B. Complement this data & send it back to Port A of
- Write a program to move a block of data from one memory location to another. Input Value
- Write a program to find Gray code equivalent of a Binary number using Lookup Table.
- Microprocessor 8086 Video Play List