Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 24 Page 1 of 1
Year : III/IV B.Tech II Semester
FACTORIAL OF A GIVEN NUMBER Aim: To write assembly language programs to find the ascending order of the given series of numbers. Registers: - Al, Bx, CL and DL Description: - Arranging the given series of numbers in ascending order and the result is stored in corresponding pointer. Ports:- None. DATA SEGMENT A DB 5 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA START: MOV CL, 05 MOV DL, 05 L1: MOV DX, 00 L2: MOV AL, A[BX] CMP AL, A[BX+1] JC L3 XCHG AL, A[BX+1] MOV A[BX], AL L3: INCBX LOOP L2 DEC DL MOV CL, 01 LOOP L1 CODE ENDS END START
Lab in-charge
HOD, ECE
Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 24 Page 2 of 1
Year : III/IV B.Tech II Semester
(2) DATA SEGMENT X DB ? FACT DB 2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START: MOV AL, 01 MOV BL, X LOOK: JZ NEXT MUL BL JNZ LOOK NEXT: MOV FACT, AL CODE ENDS END START (3) DATA SEGMENT X DB ? FACT DB 2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START: MOV AL, 01 MOV CL, X LOOK: JZ NEXT MUL CL LOOP LOOK NEXT: MOV FACT, AL CODE ENDS END START Result:-
Input :- 5 Output:- 78H
Lab in-charge
HOD, ECE