OBJECT:Write a program to calculate the Factorial of a Number.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
|MEMORY LOCATION||MACHINE CODE||OPCODE||OPERAND|
|0204||BE 00 02||MOV||SI,0200H|
|020C||F7 E3||L1 : MUL||BX|
|020F||75 FB||JNZ L1|
|0211||BF 02 02||MOV||DI,0202H|
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.
RESULT:The factorial of the hexadecimal number 0005H comes out to be as 0078H, which gets stored in the memory location 0202H.
- 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.
Most Important Question for Exam
General purpose register
Microprocessor dos not contain I/O devices
Fabricated on a tiny silicon chip
Extremely high reliablity
All of the these
All of these
To compare numbers
Either of these
IBM System /360
- 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