MPMC Lab-2
MPMC Lab-2
Lab
LAB-2
SUM & AVERAGE OF “N” 8-BIT
NUMBERS, FACTORIAL, CELSIUS TO
FAHRENHEIT
INSTRUCTION REQUIRED
OPCOD
E OPERAND EXPLANATION EXAMPLE
Algorithm:
1. Initialize SI with memory location 0500H as a starting a address to hold the value of the
count “N” and store array of numbers to be added in the consecutive memory locations
2. Initialize DI with 0600H as a starting a address to hold the result of sum of “N” numbers
3. Initialize AX register 0000H to eliminate error in the result by adding previous value of AX
4. Assign CL register with the value of the count “N” by loading it from 0500h memory
location using SI
5. Increment the content of SI to point the first element of the array
6. Perform addition on the value of AL and first element of the array (Result will be stored
again in AL)
7. Perform addition of AH+00+C bit to hold result when Lower byte addition resulted any
carry
8. Increment the content of SI to point the next element of the array
9. Decrement CL value by 1 and check whether count is reached 0
10. If not zero, repeat steps 6 to 9
11. Otherwise store the final result of sum of all numbers in the array held by AX into the
LAB -3 BECE204P - MP & MC LAB 1
LAB TASK-1
SUM OF “N” NUMBERS
Algorithm:
1. Input the Number whose factorial is to be find and Store that Number in CX
Register
2. Insert 0001 in AX(Condition for MUL Instruction) and copy AX to BX register
3. Increment BX by 1
4. Multiply AX and BX (Results stored in AX)
5. Repeat step 3 and 4 until BX repeated for CX number using CMP and JNZ
instructions
6. Use CMP and JNZ instruction to CX with AX until CX become Zero(0) using LOOP
Instruction
LAB -3 7. Copy the final content of AXBECE204P
to memory location
- MP & MC LAB 4000H 1
LAB TASK-3
FACTORIAL